> ## Documentation Index
> Fetch the complete documentation index at: https://docs.datkey.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Update key



## OpenAPI

````yaml PUT /keys/{id}
openapi: 3.0.0
info:
  title: Datkey Dev
  version: 1.0.0
servers:
  - url: https://api.datkey.dev
security: []
tags:
  - name: keys
paths:
  /keys/{id}:
    put:
      tags:
        - keys
      summary: Update key
      parameters:
        - name: x-api-key
          in: header
          schema:
            type: string
          description: your workspace API key
          example: <api_key>
        - name: id
          in: path
          schema:
            type: string
          required: true
          example: <key_id>
          description: your key ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                expires_at:
                  type: integer
                  format: int64
                  description: >-
                    a unix time stamp in the future of when you want the key to
                    expire
                verification_limit:
                  type: integer
                  format: int64
                  description: maximum verification allowed for this key
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  api_id:
                    type: string
                    example: '{api_id}'
                    description: The ID of the API the key belongs to
                  name:
                    type: string
                    example: '{api_name}'
                    description: The name assigned to the key
                  prefix:
                    type: string
                    example: prefix
                    description: The prefix assigned to the key
                  length:
                    type: integer
                    minimum: 16
                    maximum: 255
                    default: 16
                    description: The length assigned to the key
                  meta:
                    type: object
                    additionalProperties:
                      nullable: true
                    example:
                      user_id: '123456'
                    description: extra details you passed via the meta attribute
                  expires_at:
                    type: integer
                    additionalProperties:
                      nullable: true
                    format: int64
                    description: >-
                      Unix timestamp of when the key expires, returns `null`
                      when not set
                  verification_limit:
                    type: integer
                    format: int64
                    additionalProperties:
                      nullable: true
                    description: >-
                      maximum verification allowed for this key, returns `null`
                      when not set
              example:
                key:
                  id: <key_id>
                  name: <key_name>
                  key: flox_sk_05ad2bf*********
                  prefix: flox_sk
                  length: 16
                  verifications: 10
                  verification_limit: 12
                  expires_at: 1733237153
                  meta: null
                  created_at: '2023-12-05T11:31:23.000000Z'
                  updated_at: '2023-12-05T13:03:24.000000Z'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                type: object
              example:
                message: key not found
        '406':
          description: Not Acceptable
          content:
            application/json:
              schema:
                type: object
              example:
                message: key expiry cannot be back dated

````