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

# createApiTokens

> Create a new set of short-lived api access tokens. Reference for the createApiTokens mutation in the Codex API: arguments, response fields, and usage.

## GraphQL

```
type Mutation {
  # Requires a Growth or Enterprise plan.
  createApiTokens(
    input: CreateApiTokensInput!
  ): [ApiToken!]!
}

type ApiToken {
  id: String!
  token: String!
  expiresTimeString: String!
  requestLimit: String!
  remaining: String
}

input CreateApiTokensInput {
  count: Int
  requestLimit: String
  expiresIn: Int
}
```

### Example

[Test this query in the Explorer →](https://docs.codex.io/explore.md)

```graphql theme={null}
mutation {
  createApiTokens(
    input: { count: 1, requestLimit: "5000", expiresIn: 3600000 }
  ) {
    id
    token
    expiresTimeString
    requestLimit
    remaining
  }
}
```

### Usage Guidelines

* All input fields are optional: `count` defaults to 1, `requestLimit` defaults to 5000, and `expiresIn` defaults to 1 hour (3600000 milliseconds)
* The returned `token` is a JWT to be passed into the Authorization header for API requests
* `requestLimit` is the number of root fields the token is allowed to resolve before it's rate limited; `remaining` shows the approximate number of resolutions left
* `expiresTimeString` is an ISO time string for the expiry of the token

### Troubleshooting Tips

> [accordion] Are there limits on the number of tokens I can generate?
>
> `createApiTokens` accepts up to 25 tokens per call. There is no per-account limit on how many short-lived tokens you can generate over time.


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