# Regenerate an API proxy token

> Issue a new token for an API proxy and answer it once. The previous token stops working within a minute. No request body.

Source: https://docs.stacksync.com/api-reference/api-proxies/regenerate_api_proxy_token

`POST https://api.stacksync.com/v1/workspaces/{workspace_id}/api-proxy/{api_proxy_id}/regenerate-token`

- Operation: `regenerate_api_proxy_token`
- Resource: API proxies
- Access: writes data

## Authentication

- `Authorization: Bearer <key>`: A workspace API key (workspace_…, created by a workspace owner under Workspace settings > Stacksync API) acts with editor rights on that workspace only; a user API key (user_…, created under Profile > Stacksync API) acts as that user in every workspace they belong to. POST, PUT and PATCH requests must send Content-Type: application/json. Every authentication failure answers 403.

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `workspace_id` | integer | Yes | The workspace the resources belong to |
| `api_proxy_id` | string (uuid) | Yes | The API proxy; it must be yours or shared with the workspace |

## Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `region` | string (besg \| usnv) | Yes | Data region of the API proxy |

## Returns

### 200 The API proxy with its new token

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `connection_id` | string (uuid) | Yes | The connection the proxy forwards to |
| `api_proxy_id` | string (uuid) | Yes | The API proxy |
| `api_proxy_name` | string | Yes | The name of the API proxy |
| `app_type` | string | Yes | The app the proxy fronts |
| `created_by` | integer | Yes | The user who created the proxy |
| `created_time` | string | Yes | When the proxy was created |
| `last_modified_by` | integer | Yes | The user who last changed it |
| `last_modified_time` | string | Yes | When it was last changed |
| `api_proxy_token` | string | Yes | The new token, shown once. It replaces the previous token. |

## Example request

```bash
curl -X POST "https://api.stacksync.com/v1/workspaces/{workspace_id}/api-proxy/{api_proxy_id}/regenerate-token?region=besg" \
  -H "Authorization: Bearer $STACKSYNC_API_KEY"
```

## Example response (200)

```json
{
  "connection_id": "c7d8e9f0-2a3b-4c5d-9e6f-7a8b9c0d1e2f",
  "api_proxy_id": "5d6e7f80-9a0b-4c1d-8e2f-3a4b5c6d7e8f",
  "api_proxy_name": "Salesforce proxy",
  "app_type": "salesforce",
  "created_by": 1042,
  "created_time": "Thu, 01 Oct 2026 09:12:44 GMT",
  "last_modified_by": 1042,
  "last_modified_time": "Thu, 01 Oct 2026 09:12:44 GMT",
  "api_proxy_token": "Sal14vJofWyng01XMObTm6lO6rDljwaLjMo-CSiS0xAphug-Kz4tgkP3nZjrv0UQORt0A"
}
```

## Errors

| Status | Meaning | Body |
| --- | --- | --- |
| 400 | The `region` is missing or not one of besg, usnv; `api_proxy_id` is not a UUID; no API proxy with this id exists in the workspace and region, or it is not visible to the user of the API key (`Error Getting API Proxy Services`, answered with 400); the token could not be stored | `{ "error": string }` |
| 403 | Forbidden: invalid API key, API key of another workspace, insufficient scope, workspace unavailable, or a non-GET request without `Content-Type: application/json` | `{ "error": string }` |

## Related

- [API Reference overview](https://docs.stacksync.com/api-reference): base URLs, regions, pagination, idempotency and errors
- [Authentication](https://docs.stacksync.com/api-reference/authentication): API keys and the 403 answers
- OpenAPI document: https://docs.stacksync.com/openapi.json
- [List API proxies](https://docs.stacksync.com/api-reference/api-proxies/list_api_proxies)
- [Get an API proxy](https://docs.stacksync.com/api-reference/api-proxies/get_api_proxy)
- [Create an API proxy](https://docs.stacksync.com/api-reference/api-proxies/create_api_proxy)
- [Update an API proxy](https://docs.stacksync.com/api-reference/api-proxies/update_api_proxy)
- [Delete an API proxy](https://docs.stacksync.com/api-reference/api-proxies/delete_api_proxy)