> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mithunai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Replace a connection's token

> Store a new token in place of the old one. Every source that uses the connection reads with it from its next sync. The site and service do not change.

Replaces the token of a connection. Its name, its service and, for Confluence, its site stay as they are, and every source that uses it reads with the new token from its next sync. The response does not contain the token. You need the owner or admin role (`credential.manage`).

Send only the service's sign-in fields. `site_url` is refused with `400`: a connection cannot be moved to another site.

**connection\_id** `string` *required*

The connection's ID (UUID).

**fields** `object` *required*

For `github`, `notion`, `grafana`, `hubspot`, `slack`, `stripe` and `okta`: `token`. For
`atlassian` and `zendesk`: `email` and `api_token`. For `wordpress`: `username` and
`application_password`. For `google_workspace`: `service_account_json` and `admin_email`. For
`microsoft_entra`: `tenant_id`, `client_id` and `client_secret`. All strings.

## Response

Returns `200` with the connection, `rotated_at` set to now.

```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl --request POST "$MITHUNAI_URL/mithunai/api/v1/connections/$CONNECTION_ID/rotate" \
  --header "Authorization: Bearer $MITHUNAI_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{"fields": {"token": "'"$NEW_NOTION_TOKEN"'"}}'
```

```json 200 theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "6f1c2b9a-4d3e-4a8b-9c7d-2e1f0a9b8c7d",
  "name": "Docs team Notion",
  "kind": "notion",
  "host": "",
  "source_count": 1,
  "created_at": "2026-10-13T09:00:00+00:00",
  "updated_at": "2026-11-02T08:30:00+00:00",
  "rotated_at": "2026-11-02T08:30:00+00:00",
  "last_used_at": "2026-11-01T06:00:12+00:00"
}
```

```json 400 theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "code": "validation_error",
  "message": "This kind of connection does not take one of the fields that were sent."
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.