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

# Revoke an API key

> Switches a key off; it stays in the list as inactive. "legacy" switches the legacy key off. A key id not of this company answers 403. Admins and company keys only; operators and workers get 403.



## OpenAPI

````yaml v1/openapi.json POST /apikeys/{id}/revoke
openapi: 3.1.0
info:
  title: Hellotracks REST API
  version: '1'
  description: >-
    Plain REST resources over HTTPS, for tools, automations and services. The ht
    command line is built on it.
  contact:
    email: api@hellotracks.com
servers:
  - url: https://api.hellotracks.com/v1
security:
  - ApiKey: []
tags:
  - name: Sign-up and sign-in
    description: >-
      Create a company or get an API key by an emailed code, without a key; and
      check which account a key belongs to.
  - name: Company
    description: The company the API key belongs to, with its settings and teams.
  - name: Members
    description: 'The people in the company: admins, operators and workers.'
  - name: API keys
    description: 'The company''s API keys: list, create, revoke and delete.'
  - name: Jobs
    description: 'Jobs: work at a location on a date, assigned to a member.'
  - name: Places
    description: 'Places: customer sites and other saved locations with a check-in radius.'
  - name: Zones
    description: 'Zones: the company''s geofences.'
  - name: Routing
    description: Route optimization for one member's day.
  - name: ETA pages
    description: >-
      Live ETA pages (eta.page links) that show a job's recipient when the
      worker arrives.
  - name: Maps
    description: Rendered maps as GeoJSON, and public map share links.
  - name: Timesheets
    description: Clock-in and clock-out entries of members, with totals, and editing them.
  - name: Forms
    description: >-
      Form templates, submitted forms, attachments for file and image fields,
      and forms linked to places and jobs.
  - name: Alerts
    description: >-
      Alert rules (configs) that watch members, places and zones, and the alerts
      (instances) they raised.
  - name: Reports
    description: >-
      Reports: the newer reporting API (catalog, preview, run, saved) and the
      older one (types, generate, jobs, uploads, recurring).
  - name: Webhooks
    description: URLs Hellotracks calls when jobs, check-ins, clock-ins or alerts happen.
paths:
  /apikeys/{id}/revoke:
    post:
      tags:
        - API keys
      summary: Revoke an API key
      description: >-
        Switches a key off; it stays in the list as inactive. "legacy" switches
        the legacy key off. A key id not of this company answers 403. Admins and
        company keys only; operators and workers get 403.
      operationId: revokeApiKey
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: Key id, or "legacy" for the company's original key.
          example: k7x2m9qa
      responses:
        '200':
          description: All keys after the change.
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                  - error
                  - meta
                properties:
                  data:
                    $ref: '#/components/schemas/ApiKeyList'
                  error:
                    type: 'null'
                  meta:
                    $ref: '#/components/schemas/Meta'
              example:
                data:
                  items:
                    - id: legacy
                      type: legacy
                      active: true
                      expiresAt: 0
                      createdAt: 0
                      createdBy: ''
                      lastUsedAt: 0
                      label: ''
                      source: ''
                    - id: k7x2m9qa
                      type: rotatable
                      active: false
                      expiresAt: 0
                      createdAt: 1761980400000
                      createdBy: a9a9a9
                      lastUsedAt: 1761990000000
                      label: Zapier sync
                      source: zapier
                error: null
                meta:
                  path: /v1/apikeys/k7x2m9qa/revoke
                  method: POST
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  schemas:
    ApiKeyList:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/ApiKey'
          description: All of the company's keys, the legacy key first.
    Meta:
      type: object
      properties:
        path:
          type: string
          description: The request path, without /v1.
          example: /jobs
        method:
          type: string
          example: GET
    ApiKey:
      type: object
      properties:
        id:
          type: string
          description: >-
            Key id (the part before the dot), or "legacy" for the company's
            original key.
        type:
          type: string
          enum:
            - legacy
            - rotatable
        active:
          type: boolean
        expiresAt:
          type: integer
          format: int64
          description: ms timestamp; 0 never expires.
        createdAt:
          type: integer
          format: int64
          description: ms timestamp; 0 for the legacy key.
        createdBy:
          type: string
          description: Id of the account that made it.
        lastUsedAt:
          type: integer
          format: int64
          description: ms timestamp; 0 if never (always 0 for the legacy key).
        label:
          type: string
        source:
          type: string
          description: >-
            Free text naming what uses the key, e.g. ht_cli for keys from
            sign-up or email-code sign-in.
    ErrorEnvelope:
      type: object
      properties:
        data:
          type: 'null'
        error:
          $ref: '#/components/schemas/Error'
        meta:
          $ref: '#/components/schemas/Meta'
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Stable error code for programs.
          enum:
            - invalid_request
            - invalid_format
            - invalid_data
            - invalid_api_key
            - unknown_user
            - authentication_failed
            - forbidden
            - not_found
            - already_exists
            - throttled
            - not_ready
            - clock_invalid
            - force_logout
            - internal_error
            - unknown_error
        message:
          type: string
          description: Why it failed, for people.
  responses:
    Unauthorized:
      description: The API key is missing or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            data: null
            error:
              code: invalid_api_key
              message: Invalid Hellotracks API key.
            meta:
              path: /jobs
              method: GET
    Forbidden:
      description: The key may not do this.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            data: null
            error:
              code: forbidden
              message: No permission.
            meta:
              path: /jobs
              method: GET
    TooManyRequests:
      description: Too many requests; slow down.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            data: null
            error:
              code: throttled
              message: Too many requests.
            meta:
              path: /jobs
              method: GET
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: API-Key
      description: >-
        Your API key, from More → API & Integrations in the dashboard, or from
        ht signup / ht auth login.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.