---
title: "PATCH /api/database/tokens/{token_id}/"
method: PATCH
path: "/api/database/tokens/{token_id}/"
tags: ["Database tokens"]
---

# PATCH /api/database/tokens/{token_id}/

`PATCH /api/database/tokens/{token_id}/`

Updates the existing database token if it is owned by the authorized user and ifthe user has access to the related workspace.

## Path parameters

- `token_id` integer, required

## Request body

- PatchedTokenUpdate
  - `name` string — The human readable name of the database token for the user.
  - `permissions` object — Indicates per operation which permissions the database token has within the whole workspace. If the value of for example `create` is `true`, then the token can create rows in all tables related to the workspace. If a list is provided with for example `[["table", 1]]` then the token only has create permissions for the table with id 1. Same goes for if a database references is provided. `[['database', 1]]` means create permissions for all tables in the database with id 1. Example: ```json { "create": true// Allows creating rows in all tables. // Allows reading rows from database 1 and table 10. "read": [["database", 1], ["table", 10]], "update": false // Denies updating rows in all tables. "delete": [] // Denies deleting rows in all tables. } ```
    - `create` union
      - boolean — Indicating if the database token has permissions to all tables.
      - array[]
        - union[]
          - union
            - string — First element should indicate the reference type `database` or `table`.
            - number — Second element should indicate the ID of the reference.
    - `read` union
      - boolean — Indicating if the database token has permissions to all tables.
      - array[]
        - union[]
          - union
            - string — First element should indicate the reference type `database` or `table`.
            - number — Second element should indicate the ID of the reference.
    - `update` union
      - boolean — Indicating if the database token has permissions to all tables.
      - array[]
        - union[]
          - union
            - string — First element should indicate the reference type `database` or `table`.
            - number — Second element should indicate the ID of the reference.
    - `delete` union
      - boolean — Indicating if the database token has permissions to all tables.
      - array[]
        - union[]
          - union
            - string — First element should indicate the reference type `database` or `table`.
            - number — Second element should indicate the ID of the reference.
  - `rotate_key` boolean — Indicates if a new key must be generated.

## Response `200`

- Token
  - `id` integer, required
  - `name` string, required — The human readable name of the database token for the user.
  - `workspace` integer, required — Only the tables of the workspace can be accessed.
  - `key` string, required — The unique token key that can be used to authorize for the table row endpoints.
  - `permissions` object, required — Indicates per operation which permissions the database token has within the whole workspace. If the value of for example `create` is `true`, then the token can create rows in all tables related to the workspace. If a list is provided with for example `[["table", 1]]` then the token only has create permissions for the table with id 1. Same goes for if a database references is provided. `[['database', 1]]` means create permissions for all tables in the database with id 1. Example: ```json { "create": true// Allows creating rows in all tables. // Allows reading rows from database 1 and table 10. "read": [["database", 1], ["table", 10]], "update": false // Denies updating rows in all tables. "delete": [] // Denies deleting rows in all tables. } ```
    - `create` union
      - boolean — Indicating if the database token has permissions to all tables.
      - array[]
        - union[]
          - union
            - string — First element should indicate the reference type `database` or `table`.
            - number — Second element should indicate the ID of the reference.
    - `read` union
      - boolean — Indicating if the database token has permissions to all tables.
      - array[]
        - union[]
          - union
            - string — First element should indicate the reference type `database` or `table`.
            - number — Second element should indicate the ID of the reference.
    - `update` union
      - boolean — Indicating if the database token has permissions to all tables.
      - array[]
        - union[]
          - union
            - string — First element should indicate the reference type `database` or `table`.
            - number — Second element should indicate the ID of the reference.
    - `delete` union
      - boolean — Indicating if the database token has permissions to all tables.
      - array[]
        - union[]
          - union
            - string — First element should indicate the reference type `database` or `table`.
            - number — Second element should indicate the ID of the reference.

## Other responses

- `400`
- `404`

---

[API](https://skmtc.net/baserow/apis/baserow-api-spec.md) · [All operations](https://skmtc.net/baserow/apis/baserow-api-spec/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/baserow/baserow-api-spec/revisions/0c490e5b0c7f/schema)
