> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # update > Update an existing API token. ### tokens.update Update an existing API token. Uses PATCH. ### Schema ```yaml openapi: 3.1.0 info: title: API version: 1.0.0 paths: /api/project/tokens/{token_id}: patch: operationId: subpackageProjectTokens_update_token summary: Update API token description: >- Changes the name or enabled permission categories of an existing project API token. Use it to rotate a token's responsibilities without replacing its identifier; remove permissions that the token's server-side caller no longer needs. For the account-scoped Compatibility API route, use [Update an API Token](/docs/compatibility-api/rest/tokens/update-token). The response contains the token's `id`, `name`, and `permissions` only. The token secret is returned once, by [Create API token](/docs/apis/rest/project-tokens/create-token), and cannot be retrieved afterwards. #### Permissions With a project API token, the token must have the following scope(s) enabled to make a successful request: _Management_. With a [Personal access token](/docs/apis/authorization#personal-access-tokens) there are no scopes. The token holder must be an owner or admin of the space, and the request reaches only the projects the holder is enabled for, plus their subprojects. [Learn more about API scopes](/docs/platform/your-signalwire-api-space). #### Token Permissions You can modify the functions allowed by this API Token by selecting which types of requests this API Token is allowed to make. Valid options are: calling, chat, datasphere, fax, management, messaging, numbers, pubsub, storage, tasking, and video tags: - subpackage_projectTokens parameters: - name: token_id in: path description: The unique identifier of the token to update. required: true schema: $ref: '#/components/schemas/uuid' responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/Project.TokenResponse' '401': description: Access is unauthorized. content: application/json: schema: $ref: '#/components/schemas/Types.StatusCodes.StatusCode401' '404': description: The server cannot find the requested resource. content: application/json: schema: $ref: '#/components/schemas/Types.StatusCodes.StatusCode404' '422': description: >- The request failed validation. A `project_id` the Personal access token holder cannot reach returns `invalid_project_id`, and a `subproject_id` that is not a child of the resolved project returns `invalid_subproject_id`. A blank `name` or an empty `permissions` array returns a standard validation error. content: application/json: schema: $ref: '#/components/schemas/Project.TokenStatusCode422' '500': description: An internal server error occurred. content: application/json: schema: $ref: '#/components/schemas/Types.StatusCodes.StatusCode500' requestBody: content: application/json: schema: $ref: '#/components/schemas/Project.UpdateTokenRequest' tags: - name: subpackage_projectTokens servers: - url: https://%7BYour_Space_Name%7D.signalwire.com description: SignalWire API components: schemas: uuid: type: string format: uuid description: Universal Unique Identifier. title: uuid Project.TokenPermission: type: string enum: - calling - chat - datasphere - fax - management - messaging - numbers - pubsub - storage - tasking - video description: Valid permission types for API tokens. title: Project.TokenPermission Project.UpdateTokenRequest: type: object properties: name: type: string description: The name representing the API token. permissions: type: array items: $ref: '#/components/schemas/Project.TokenPermission' description: >- The permissions you would like to enable for this token. Valid permissions are calling, chat, datasphere, fax, management, messaging, numbers, pubsub, storage, tasking, and video description: Request body for updating an API Token. title: Project.UpdateTokenRequest Project.TokenResponse: type: object properties: id: $ref: '#/components/schemas/uuid' description: The ID of the API Token. name: type: string description: The name of the API Token. permissions: type: array items: $ref: '#/components/schemas/Project.TokenPermission' description: The permissions enabled for this token. required: - id - name - permissions title: Project.TokenResponse TypesStatusCodesStatusCode401Error: type: string enum: - Unauthorized title: TypesStatusCodesStatusCode401Error Types.StatusCodes.StatusCode401: type: object properties: error: $ref: '#/components/schemas/TypesStatusCodesStatusCode401Error' required: - error description: Access is unauthorized. title: Types.StatusCodes.StatusCode401 TypesStatusCodesStatusCode404Error: type: string enum: - Not Found title: TypesStatusCodesStatusCode404Error Types.StatusCodes.StatusCode404: type: object properties: error: $ref: '#/components/schemas/TypesStatusCodesStatusCode404Error' required: - error description: The server cannot find the requested resource. title: Types.StatusCodes.StatusCode404 Types.StatusCodes.RestApiErrorItem: type: object properties: type: type: string description: The category of error. code: type: string description: A specific error code. message: type: string description: A description of what caused the error. attribute: type: - string - 'null' description: The request parameter that caused the error, if applicable. url: type: string description: A link to documentation about this error. required: - type - code - message - url description: Details about a specific error. title: Types.StatusCodes.RestApiErrorItem Project.TokenStatusCode422: type: object properties: errors: type: array items: $ref: '#/components/schemas/Types.StatusCodes.RestApiErrorItem' description: List of validation errors. required: - errors description: >- The request failed validation. A `project_id` the Personal access token holder cannot reach returns `invalid_project_id`, and a `subproject_id` that is not a child of the resolved project returns `invalid_subproject_id`. A blank `name` or an empty `permissions` array returns a standard validation error. title: Project.TokenStatusCode422 TypesStatusCodesStatusCode500Error: type: string enum: - Internal Server Error title: TypesStatusCodesStatusCode500Error Types.StatusCodes.StatusCode500: type: object properties: error: $ref: '#/components/schemas/TypesStatusCodesStatusCode500Error' required: - error description: An internal server error occurred. title: Types.StatusCodes.StatusCode500 ``` ## **Response Example** ### Response (200) ```json { "id": "ea14556a-984f-11ee-b9d1-0242ac120002", "name": "John Doe's Token", "permissions": [ "calling", "fax", "messaging" ] } ``` ## **Example** ```typescript {9-9} import { RestClient } from "@signalwire/sdk"; const client = new RestClient({ project: "your-project-id", token: "your-api-token", host: "your-space.signalwire.com" }); await client.project.tokens.update("token-id", { name: "renamed-token" }); ``` > Update an existing API token.