> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# update

> Update an API token.

Update an API token. Uses PATCH.

### Schema

```yaml
openapi: 3.1.0
info:
  title: API
  version: 1.0.0
paths:
  /Accounts/{AccountSid}/tokens/{token_id}:
    patch:
      operationId: update_token
      summary: Update an API Token
      description: >-
        Update an API Token's name or permissions.


        #### Permissions


        The API token used to authenticate must have the following scope(s)
        enabled to make a successful request: _Management_.


        [Learn more about API scopes](/docs/platform/your-signalwire-api-space).
      tags:
        - subpackage_tokens
      parameters:
        - name: AccountSid
          in: path
          description: >-
            The unique identifier for the project you want to use to
            authenticate this request.
          required: true
          schema:
            $ref: '#/components/schemas/uuid'
        - name: token_id
          in: path
          description: The unique identifier of the project API token.
          required: true
          schema:
            $ref: '#/components/schemas/uuid'
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenResponse'
        '400':
          description: >-
            The request was invalid or cannot be processed. Check the error
            details for more information.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompatibilityErrorResponse'
        '401':
          description: Authentication failed. Please verify your credentials and try again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompatibilityErrorResponse'
        '404':
          description: >-
            The requested resource was not found. Please verify the resource
            identifier.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompatibilityErrorResponse'
        '422':
          description: >-
            The token request could not be processed due to validation errors.
            Check the error details for the specific issue.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompatibilityTokenValidationError'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateTokenRequest'
servers:
  - url: https://YOUR_SPACE.signalwire.com/api/laml/2010-04-01
    description: SignalWire Compatibility API
components:
  schemas:
    uuid:
      type: string
      format: uuid
      description: Universal Unique Identifier.
      title: uuid
    UpdateTokenRequest:
      type: object
      properties:
        name:
          type: string
          description: The name representing the project API token.
        permissions:
          type: array
          items:
            type: string
          description: >-
            The permissions you would like to enable for this project API token.
            If not provided, existing permissions are kept. Valid permissions
            are: calling, chat, datasphere, fax, management, messaging, numbers,
            pubsub, storage, tasking, and video.
      description: Request body for updating an API token.
      title: UpdateTokenRequest
    TokenResponse:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/uuid'
          description: The unique identifier of the created API Token.
        name:
          type: string
          description: The name of the created API Token.
        permissions:
          type: array
          items:
            type: string
          description: The permissions enabled for this token.
        token:
          type: string
          description: >-
            The API token that can be used along with the project ID for basic
            authentication.
      required:
        - id
        - name
        - permissions
        - token
      description: Response containing a single token.
      title: TokenResponse
    CompatibilityErrorResponse:
      type: object
      properties:
        code:
          type: integer
          description: Error code.
        message:
          type: string
          description: Error message.
        more_info:
          type: string
          description: URL for more information about the error.
        status:
          type: integer
          description: HTTP status code.
      required:
        - code
        - message
        - more_info
        - status
      description: Error response model.
      title: CompatibilityErrorResponse
    CompatibilityTokenValidationError:
      type: object
      properties:
        type:
          type: string
          description: Error type.
        code:
          type: string
          description: Error code.
        message:
          type: string
          description: Error message.
        attribute:
          type: string
          description: Request parameter associated with this error.
        url:
          type: string
          format: uri
          description: Link to developer resource for this error.
      description: Token validation error response model.
      title: CompatibilityTokenValidationError

```

## **Response Example**

### Response (200)

```json
{
  "id": "ea14556a-984f-11ee-b9d1-0242ac120002",
  "name": "John Doe's Token",
  "permissions": [
    "calling",
    "fax",
    "messaging"
  ],
  "token": "PT037258e533e87ac63174ee136ed0798dc85d4f4f9e6d7191"
}
```

## **Example**

```python {9}
from signalwire.rest import RestClient

client = RestClient(
    project="your-project-id",
    token="your-api-token",
    host="your-space.signalwire.com",
)

client.compat.tokens.update("token-id", name="updated-token")
```