Skip to content

Code Snippets

Generate ready-to-use code snippets for any endpoint in your project. Right-click an endpoint or use the Copy as Code button to get a working request in your language of choice.

FormatLanguageUse Case
cURLShellCommand-line testing, documentation
fetchJavaScriptBrowser and Node.js applications
axiosJavaScriptPopular HTTP client for Node.js/browser
PythonPythonPython requests library
  1. Right-click an endpoint in the tree view
  2. Select Copy as Code
  3. Choose your format
  4. The snippet is copied to your clipboard
  1. Open an endpoint for editing
  2. Click the Copy as Code dropdown in the toolbar
  3. Select a format
  4. The snippet is copied to your clipboard

Each snippet includes:

  • The correct HTTP method
  • The full URL with your server’s base URL and the endpoint path
  • Content-Type: application/json header for POST/PUT/PATCH requests
  • A request body template (simplified from your mock response, with template variables stripped)
Terminal window
curl -X GET http://localhost:3001/api/users
fetch('http://localhost:3001/api/users')
.then(response => response.json())
.then(data => console.log(data));
axios.get('http://localhost:3001/api/users')
.then(response => console.log(response.data));
import requests
response = requests.get('http://localhost:3001/api/users')
print(response.json())
  • Quick sharing: Copy a cURL snippet to share an endpoint call with a teammate
  • Documentation: Paste generated snippets into your API docs as usage examples
  • Request bodies: For POST/PUT/PATCH endpoints, the snippet includes a body template based on your mock response schema