---
title: "Create a new access token"
method: POST
path: "/api/auth/token"
tags: ["Auth", "GradleEnterprise", "Develocity"]
---

# Create a new access token

`POST /api/auth/token`

## Request

- Base URL: `https://develocity.example.com`
- URL: `https://develocity.example.com/api/auth/token`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/develocity/apis/develocity-api/docs/api/auth/token/post.ts> (a function with typed inputs; its response is checked against the schema)

Create a new short-lived access token, optionally limited to the provided permissions and projects. Users do not need any specific Develocity permission to do this, but must be authenticated. If an access key is used to authenticate this request, the created token will be limited to the user's permissions and projects. If an access token is used to authenticate this request, the created token will be limited to the authenticating token's permissions and projects and not live longer than the authenticating token's remaining lifetime. Query parameters can be used to further restrict the permissions of the access token. A 401 response will be sent if the request is not authenticated. A 403 response will be sent if one of the projects or permissions present in the query parameters is not assigned to this user. A 403 will also be sent if an access token is used to authenticate the request and the requested expiration date is after the authenticating access token's expiration.

## Query parameters

- `projectIds` ProjectId[]
- `permissions` Permission[]
- `expiresInHours` number, float

## Response `200`

An access token

## Other responses

- `400`: The request cannot be fulfilled due to a problem.
- `401`: Something was wrong with the request.
- `403`: The current user or authenticating access token does not have sufficient access or lifetime to create the requested access token.
- `404`: The referenced resource either does not exist or the permissions to know about it are missing.
- `500`: The server encountered an unexpected error.

---

[API](https://skmtc.dev/develocity/apis/develocity-api.md) - [All operations](https://skmtc.dev/develocity/apis/develocity-api/llms.txt) - [OpenAPI document](https://skmtc.dev/develocity/apis/develocity-api/revisions/b49835fbf065?raw)
