> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.bibleit.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.bibleit.dev/_mcp/server.

# Rotate a service-token secret

POST https://api.bibleit.app/v1/organizations/{organization_id}/service-tokens/{credential_id}/rotations
Content-Type: application/json

**Required scopes:** `token.create`.

Immediately invalidates the old secret and returns the replacement once. Preserves label, scopes, and expiry; does not renew an expired token (404). The caller must hold every target scope. Both authorization and If-Match are checked after the organization lock. Rotation of your own token requires storing the returned replacement before any subsequent calls. Do not retry an ambiguous response with a fresh validator; the previous response secret cannot be recovered. Idempotency-Key is unsupported and rejected with 422 idempotency_not_supported. No secret-bearing response or one-use download stream is retained.

**Response headers:**

- `ETag` (200): Configuration validator. Excludes volatile last-use metadata, which is available in the token list only. Rotation invalidates this validator.

Reference: https://docs.bibleit.dev/api-reference/organizations/service-tokens/rotate-service-token

## Authentication

- `Authorization` header (bearer token, required) — Organization-owned service token. Issue the initial token in organization credential settings. Scopes are documented per operation via x-required-scopes; they are not OAuth scopes.

## Request

### Path parameters

- `organization_id` (string, required)
- `credential_id` (string, required)

### Headers

- `If-Match` (string, required) — Use the latest service-token configuration ETag unchanged. Missing: 428; stale: 412. Wildcards, lists and weak validators are rejected.

## Response

### 200

Successful operation

- `id` (string, required)
- `organization_id` (string, required)
- `label` (string, required)
- `scopes` (list of enum, required)
  - Allowed values: `server.get`, `help.get`, `translation.get`, `translation.list`, `translation.read`, `translation.search`, `translation.enable`, `live.get`, `live.list`, `live.subscribe`, `live.create`, `live.update`, `live.delete`, `token.get`, `token.create`, `token.delete`, `live_studio.get`, `live_studio.update`, `presentation.get`, `presentation.list`, `presentation.create`, `presentation.update`, `presentation.delete`, `presentation.export`, `presentation.present`, `organization.get`, `membership.get`, `membership.update`, `membership.delete`, `live.move`, `asset.get`, `asset.create`, `presentation.import`
- `expires_at` (integer, required, nullable) — Unix timestamp in seconds; null means no deadline or no recorded use.
- `secret` (string, required) — Returned once. Store in a confidential backend.

## Errors

### 401 Unauthorized Error

Error response. 400 malformed JSON; 401 invalid/expired/revoked token; 403 denied scope or domain policy; 404 unknown/foreign resource; 405 unsupported method; 409 quota/conflict or stopped Live; 412 stale state validator; 428 missing If-Match; 413 body too large; 415 unsupported media type; 422 invalid fields; 429 admission budget exhausted; 503 unavailable dependency.

- `type` (any, required)
- `title` (string, required)
- `status` (integer, required)
- `code` (string, required)
- `request_id` (string, required)

### 403 Forbidden Error

Error response. 400 malformed JSON; 401 invalid/expired/revoked token; 403 denied scope or domain policy; 404 unknown/foreign resource; 405 unsupported method; 409 quota/conflict or stopped Live; 412 stale state validator; 428 missing If-Match; 413 body too large; 415 unsupported media type; 422 invalid fields; 429 admission budget exhausted; 503 unavailable dependency.

- `type` (any, required)
- `title` (string, required)
- `status` (integer, required)
- `code` (string, required)
- `request_id` (string, required)

### 404 Not Found Error

Error response. 400 malformed JSON; 401 invalid/expired/revoked token; 403 denied scope or domain policy; 404 unknown/foreign resource; 405 unsupported method; 409 quota/conflict or stopped Live; 412 stale state validator; 428 missing If-Match; 413 body too large; 415 unsupported media type; 422 invalid fields; 429 admission budget exhausted; 503 unavailable dependency.

- `type` (any, required)
- `title` (string, required)
- `status` (integer, required)
- `code` (string, required)
- `request_id` (string, required)

### 429 Too Many Requests Error

Error response. 400 malformed JSON; 401 invalid/expired/revoked token; 403 denied scope or domain policy; 404 unknown/foreign resource; 405 unsupported method; 409 quota/conflict or stopped Live; 412 stale state validator; 428 missing If-Match; 413 body too large; 415 unsupported media type; 422 invalid fields; 429 admission budget exhausted; 503 unavailable dependency.

- `type` (any, required)
- `title` (string, required)
- `status` (integer, required)
- `code` (string, required)
- `request_id` (string, required)

### 503 Service Unavailable Error

Error response. 400 malformed JSON; 401 invalid/expired/revoked token; 403 denied scope or domain policy; 404 unknown/foreign resource; 405 unsupported method; 409 quota/conflict or stopped Live; 412 stale state validator; 428 missing If-Match; 413 body too large; 415 unsupported media type; 422 invalid fields; 429 admission budget exhausted; 503 unavailable dependency.

- `type` (any, required)
- `title` (string, required)
- `status` (integer, required)
- `code` (string, required)
- `request_id` (string, required)

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "id": "string",
  "organization_id": "string",
  "label": "string",
  "scopes": [
    "server.get"
  ],
  "expires_at": 1,
  "secret": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.bibleit.app/v1/organizations/organization_id/service-tokens/credential_id/rotations"

payload = {}
headers = {
    "If-Match": "If-Match",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.bibleit.app/v1/organizations/organization_id/service-tokens/credential_id/rotations"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("If-Match", "If-Match")
	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```