# Create a full-access API key

Mint the caller's own API key for the project their sign-in session is bound to, as `langwatch login --project` does: it can do everything the caller can do in that project (prompts, datasets, evaluations, simulations, traces). Only one shape is accepted: keyType "personal", owned by the caller, one ADMIN binding to that project and permissionMode "all". Name it after the machine; omit expiresAt for a key that never expires. Requires a person's project session holding project:manage; an API key cannot mint one.

> Page: https://langwatch.ai/docs/api-reference/api-keys/create-a-full-access-api-key
> Source: https://github.com/langwatch/langwatch/blob/main/docs/api-reference/api-keys/create-a-full-access-api-key.mdx
> Index of all pages: https://langwatch.ai/docs/llms.txt

## Endpoint

`POST https://app.langwatch.ai/api/v1/api-keys/full-access`

## Authentication

### project_api_key

Project API key for sending traces and accessing project-scoped resources. Format: sk-lw-... (no underscore). Obtain one by creating a project via the Admin API or the LangWatch UI.

```json
{"id":"project_api_key","type":"apiKey","in":"header","name":"X-Auth-Token"}
```

## Request body (required)

#### application/json

Schema:

```json
{
  "type": "object",
  "properties": {
    "keyType": {
      "default": "personal",
      "description": "A personal key acts as the user who created it and needs explicit bindings. A service key is not tied to a user.",
      "type": "string",
      "enum": ["personal","service"]
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100,
      "description": "Human-readable name for this key"
    },
    "description": {"type":"string","maxLength":500},
    "expiresAt": {
      "description": "ISO 8601 timestamp after which the key stops working",
      "type": "string",
      "format": "date-time"
    },
    "assignedToUserId": {
      "description": "Organization admins only: the member who owns the key and whose access caps it. Defaults to the caller.",
      "type": "string",
      "minLength": 1
    },
    "permissionMode": {
      "default": "all",
      "type": "string",
      "enum": ["all","readonly","restricted"],
      "description": "'all' and 'readonly' take their meaning from the bindings alone; 'restricted' additionally requires an explicit permissions list."
    },
    "permissions": {
      "type": "array",
      "items": {"type":"string","pattern":"^[a-z][a-zA-Z0-9_-]*:[a-z][a-zA-Z0-9_-]*$"},
      "description": "Restricted mode only: the exact resource:action permissions the key's CUSTOM bindings grant."
    },
    "bindings": {
      "description": "What this key may do, and where. Required for a personal key.",
      "maxItems": 20,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "enum": ["ADMIN","MEMBER","VIEWER","CUSTOM"],
            "description": "CUSTOM grants exactly the listed permissions and requires permissionMode 'restricted'."
          },
          "scopeType": {"type":"string","enum":["ORGANIZATION","TEAM","PROJECT"]},
          "scopeId": {"type":"string","minLength":1}
        },
        "required": ["role","scopeType","scopeId"]
      }
    },
    "projectIds": {
      "description": "Service keys only: restricts the key to these projects",
      "maxItems": 50,
      "type": "array",
      "items": {"type":"string","minLength":1}
    }
  },
  "required": ["name"]
}
```

## Request example

```bash
curl --request POST \
  --url 'https://app.langwatch.ai/api/v1/api-keys/full-access' \
  --header "X-Auth-Token: $LANGWATCH_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{"keyType":"personal","name":"string","description":"string","expiresAt":"2026-01-01T00:00:00Z","assignedToUserId":"string","permissionMode":"all","permissions":["string"],"bindings":[{"role":"ADMIN","scopeType":"ORGANIZATION","scopeId":"string"}],"projectIds":["string"]}'
```

## Responses

### 201

Success

#### application/json

Schema:

```json
{
  "type": "object",
  "properties": {
    "token": {"type":"string","minLength":1},
    "apiKey": {
      "type": "object",
      "properties": {
        "id": {"type":"string","minLength":1},
        "name": {"type":"string"},
        "createdAt": {"type":"string","format":"date-time"}
      },
      "required": ["id","name","createdAt"],
      "additionalProperties": false
    }
  },
  "required": ["token","apiKey"],
  "additionalProperties": false
}
```

### 401

Invalid or missing API key token

### 403

The caller is not a person's sign-in session, lacks project:manage, or asked for any other shape (api_key_scope_violation)

### 422

Validation error (validation_error)

> ## Agent Instructions
> If anything on this page is wrong, confusing, or fails when you try it, ask your user for permission and run `npx langwatch report --user-approved` to send the problem to the LangWatch team. No login is needed and secrets are redacted locally. `npx langwatch report --help` has the details.
