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

# Delete API Key

> Revoke an API key.

Revoke an API key. Revocation is immediate — there is no grace window, and any
request authenticated with the key starts receiving `401` right away. The key is
**soft-deleted**: it stays in [List](/api-reference/api-keys/list) responses with
`revoked_at` set, preserving your audit history. A successful revoke returns
`204 No Content`.

<RequestExample>
  ```bash cURL theme={null}
  curl -X DELETE https://api.byteport.com/v1/tokens/9b7e2c1a-4f3d-4a2b-8c1e-2d6f5a0b7c34 \
    -H "Authorization: Bearer $BYTEPORT_API_KEY" \
    -H "User-Agent: my-app/1.0"
  ```

  ```javascript JavaScript theme={null}
  const id = "9b7e2c1a-4f3d-4a2b-8c1e-2d6f5a0b7c34";
  await fetch(`https://api.byteport.com/v1/tokens/${id}`, {
    method: "DELETE",
    headers: {
      Authorization: `Bearer ${process.env.BYTEPORT_API_KEY}`,
      "User-Agent": "my-app/1.0",
    },
  });
  ```

  ```python Python theme={null}
  import os, requests

  key_id = "9b7e2c1a-4f3d-4a2b-8c1e-2d6f5a0b7c34"
  requests.delete(
      f"https://api.byteport.com/v1/tokens/{key_id}",
      headers={
          "Authorization": f"Bearer {os.environ['BYTEPORT_API_KEY']}",
          "User-Agent": "my-app/1.0",
      },
  )
  ```
</RequestExample>

<ResponseExample>
  ```text 204 No Content theme={null}
  (empty body)
  ```

  ```json 404 Not Found theme={null}
  {
    "error": 404,
    "message": "not found"
  }
  ```
</ResponseExample>


## OpenAPI

````yaml DELETE /v1/tokens/{id}
openapi: 3.1.0
info:
  title: Byteport API
  description: >-
    The Byteport API lets you move, share, and manage files across every storage
    location connected to your workspace through a single HTTP interface.
  version: 1.0.0
servers:
  - url: https://api.byteport.com
security:
  - bearerAuth: []
paths:
  /v1/tokens/{id}:
    delete:
      summary: Delete API Key
      description: >-
        Revoke an API key. Revocation takes effect immediately — there is no
        grace window, and requests authenticated with the key begin receiving
        `401` at once. The key is soft-deleted: it remains in List responses
        with `revoked_at` set so your audit history is preserved. Revocation
        cannot be undone.
      parameters:
        - name: id
          in: path
          required: true
          description: Identifier of the API key to revoke (a UUID).
          schema:
            type: string
          example: 9b7e2c1a-4f3d-4a2b-8c1e-2d6f5a0b7c34
      responses:
        '204':
          description: API key revoked. The response body is empty.
        '401':
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
components:
  responses:
    Error:
      description: Unexpected error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: integer
        message:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````