> ## 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

<div data-generated>
  ## 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
  }
  ```
</div>

### Example

<a href="/explore" target="_blank" rel="noopener noreferrer">Test this query in the Explorer →</a>

```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

<AccordionGroup>
  <Accordion title="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.
  </Accordion>
</AccordionGroup>
