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

# POST /projects/{project}/auth/tokens

> Creates a new Project API Token for the project.

Creates a new Project API Token for the project.

## Endpoint details

<ParamField header="Authorization" type="string" required>
  Bearer `pat_...` (Project API Token). Keep this token on your backend/server.
</ParamField>

<ParamField path="project" type="string" required>
  Project slug. This acts as the Project ID in API paths.
</ParamField>

<ResponseField name="ok" type="boolean" required>
  `true` for a successful response and `false` for an error response.
</ResponseField>

<ResponseField name="data" type="object | null">
  Endpoint-specific response data when `ok` is `true`; `null` on errors.
</ResponseField>

<ResponseField name="error" type="object | null">
  Error code and message when `ok` is `false`; `null` on success.
</ResponseField>

<ResponseField name="request_id" type="string" required>
  Request identifier you can use when troubleshooting a specific API call.
</ResponseField>

## Authentication

Project API Token.

## Parameters

Body: `token_name` optional. If you send `token_type`, it must be `project_api_token`.

## Notes

Creating a new Project API Token does not revoke existing Project API Tokens for the same ZangTable account user inside that project. Revoke old tokens explicitly when you no longer want them to work.

## Request examples

Basic request:

```bash theme={null}
curl -X POST "$BASE_URL/projects/{project}/auth/tokens" \
  -H 'Authorization: Bearer pat_PROJECT_TOKEN' \
  -H 'Content-Type: application/json' \
  --data '{"token_name":"production-api"}'
```

Full request:

```bash theme={null}
curl -X POST "$BASE_URL/projects/{project}/auth/tokens" \
  -H 'Authorization: Bearer pat_PROJECT_TOKEN' \
  -H 'Content-Type: application/json' \
  -H 'X-Operation-Key: edit-profile-email' \
  -H 'X-Operation-Run-Id: oprun_client_20260602_001' \
  --data '{"token_type":"project_api_token","token_name":"production-api"}'
```

## Response examples

Success:

```json theme={null}
{
  "ok": true,
  "data": {
    "token": {
      "token": "pat_PROJECT_TOKEN",
      "token_id": 9,
      "token_type": "project_api_token",
      "token_name": "production-api",
      "expires_at": null
    }
  },
  "error": null,
  "request_id": "req_20260602T012345_123456Z_abc123def456",
  "operation_key": "edit-profile-email",
  "operation_run_id": "oprun_20260602T012300_000000Z_a1b2c3d4e5f6",
  "operation_grouping_status": "accepted_provided_run",
  "meta": {
    "generated_at": "2026-06-02T01:23:45Z"
  }
}
```

Error or alternate response:

```json theme={null}
{
  "ok": false,
  "data": null,
  "error": {
    "code": "permission_denied",
    "message": "This credential cannot create Project API Tokens."
  },
  "request_id": "req_20260602T012345_123456Z_abc123def456",
  "meta": {
    "generated_at": "2026-06-02T01:23:45Z"
  }
}
```
