<!-- https://testapilocally.com/docs/core-features/code-generation/ -->
# Code generation

* **Platform Availability:** Windows App · VS Code Extension (shared shell)
* **Overview:** Export the active request as cURL, JavaScript, Python, and other httpsnippet targets so you can paste into apps, tickets, or CI.

![Windows - Generate code](/docs/assets/screenshots/windows/windows-generate-code.png)

## How It Works (Windows App)

1. Open a request in API mode.
2. Use **Generate Code** from the request context menu or the generate-code control.
3. In the compact centered dialog, pick a language/target and copy or download the snippet.

## How It Works (VS Code Extension)

1. Same Generate Code modal inside the webview.
2. Alternatively reveal the request file via **SignOff Studio: Reveal in File Explorer** if you need the stored definition.

![VS Code - Generate code](/docs/assets/screenshots/vscode/vscode-generate-code.png)

## Code / Configuration Examples

Generated cURL (illustrative):

```bash
curl --request GET \
  --url 'https://httpbingo.org/get?foo=bar' \
  --header 'Accept: application/json'
```

Generated fetch:

```javascript
const response = await fetch("https://httpbingo.org/get?foo=bar", {
  method: "GET",
  headers: { Accept: "application/json" },
});
const data = await response.json();
```

## Edge Cases, Troubleshooting & Pro-Tips

- Environment variables may appear unresolved in snippets — substitute secrets carefully.
- Prefer cURL for sharing repros in GitHub issues.

## Next

- [Requests](/docs/core-features/requests/)
- [Import & export](/docs/core-features/import-export/)
