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

# Revoke a sandbox agent credential



## OpenAPI

````yaml /api-reference/openapi.json post /v1/agent-credentials/{credentialId}/revoke
openapi: 3.0.0
info:
  title: WattShift API
  description: An API for the WattShift Service (https://wattshift.com/partners)
  version: '1.0'
  contact: {}
servers: []
security: []
tags: []
paths:
  /v1/agent-credentials/{credentialId}/revoke:
    post:
      tags:
        - agent-credentials
      summary: Revoke a sandbox agent credential
      operationId: revokeAgentSandboxCredential
      parameters:
        - name: credentialId
          required: true
          in: path
          schema:
            type: string
        - name: x-ws-api-key
          in: header
          description: WattShift API Key
          schema:
            type: string
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                reason:
                  type: string
                  maxLength: 255
            example:
              reason: Prototype finished; credential no longer needed.
      responses:
        '200':
          description: Sandbox credential revocation result.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentCredentialRevocationResponseDto'
              example:
                outcome: revoked
                credential_id: ws_agent_cred_123456789
                request_id: ws_request_123456789
                production_access: false
                next_steps: >-
                  Request a new sandbox credential when you need API access
                  again.
        '400':
          description: Validation failure
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelopeDto'
              example:
                request_id: req_123
                error_code: VALIDATION_FAILED
                message: Request validation failed.
                field_errors:
                  - field: zipcode
                    message: zipcode is invalid
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelopeDto'
              example:
                request_id: req_123
                error_code: AUTH_MISSING_API_KEY
                message: Missing x-ws-api-key header.
                recovery_action: >-
                  Provide the x-ws-api-key header. If this contradicts the
                  public docs or OpenAPI contract, submit structured feedback
                  through /v1/feedback.
        '403':
          description: Credential mismatch.
      security:
        - x-ws-api-key: []
components:
  schemas:
    AgentCredentialRevocationResponseDto:
      type: object
      properties:
        outcome:
          type: string
          enum:
            - revoked
        credential_id:
          type: string
        request_id:
          type: string
        production_access:
          type: boolean
        next_steps:
          type: string
      required:
        - outcome
        - credential_id
        - request_id
        - production_access
        - next_steps
    ApiErrorEnvelopeDto:
      type: object
      properties:
        request_id:
          type: string
          example: req_123
        error_code:
          type: string
          enum:
            - AUTH_MISSING_API_KEY
            - AUTH_INVALID_API_KEY
            - AUTH_EXPIRED_CREDENTIAL
            - AUTH_REVOKED_CREDENTIAL
            - AUTH_INSUFFICIENT_SCOPE
            - VALIDATION_FAILED
            - RATE_LIMITED
            - NOT_FOUND
            - FORBIDDEN
            - PRODUCTION_ACCESS_DENIED
            - INTERNAL_ERROR
          example: VALIDATION_FAILED
        message:
          type: string
          example: Request validation failed.
        recovery_action:
          type: string
          example: >-
            Provide the x-ws-api-key header. If this contradicts the public
            docs, submit feedback through /v1/feedback.
        field_errors:
          type: array
          items:
            $ref: '#/components/schemas/ApiFieldErrorDto'
        retry_after_seconds:
          type: number
          example: 3600
      required:
        - request_id
        - error_code
        - message
    ApiFieldErrorDto:
      type: object
      properties:
        field:
          type: string
          example: zipcode
        message:
          type: string
          example: zipcode is invalid
      required:
        - message
  securitySchemes:
    x-ws-api-key:
      type: apiKey
      in: header
      name: x-ws-api-key
      description: WattShift API key

````