---
title: "Create API Token"
method: POST
path: "/orgs/{org_slug}/api-tokens"
tags: ["api-tokens"]
---

# Create API Token

`POST /orgs/{org_slug}/api-tokens`

Create an API Token. The API Token created must use a subset of permissions the API token creating them.

This endpoint consumes 10 units of your quota.

This endpoint requires the following org token scopes:
- api-tokens:create

## Path parameters

- `org_slug` string, required

## Request body

- object
  - `max_quota` integer, required — Maximum number of API calls allowed per month
  - `scopes` string[], required — List of scopes granted to the API Token
  - `visibility` 'admin' | 'organization', required — The visibility of the API Token. Warning: this field is deprecated and will be removed in the future.
  - `committer` object, required — Committer information to associate with the API Token
    - `email` string — Email address of the committer
    - `provider` 'api' | 'azure' | 'bitbucket' | 'github' | 'gitlab' — The source control provider for the committer
    - `providerLoginName` string — Login name on the provider platform
    - `providerUserId` string — User ID on the provider platform
  - `name` string — Name for the API Token
  - `resources` object[] — List of resources this API Token can access. Tokens with resource grants can only access a subset of routes that support this feature.
    - `organizationSlug` string, required — Slug of the organization to grant access to
    - `repositorySlug` string, required — Slug of the repository to grant access to
    - `workspace` string — Workspace slug containing the specified repo

## Response `200`

The newly created api token with its stable UUID and hash.

- object
  - `created_by` string, uuid, nullable, required — ID of the Socket user who created the API Token
  - `group_uuid` string, uuid, required — The stable group UUID that remains constant across token rotations
  - `token` string, required
  - `hash` string, required

## Other responses

- `401` — Unauthorized
- `403` — Insufficient max_quota for API method
- `404` — Resource not found
- `429` — Insufficient quota for API route

---

[API](https://skmtc.dev/socket-dev/apis/socket.md) · [All operations](https://skmtc.dev/socket-dev/apis/socket/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/socket-dev/socket/revisions/bf994b75d33f/schema)
