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

# Revoke this key

> Ends the key you send in the `Authorization` header, at once. Use it the moment a key leaks, at any hour. Any key can revoke itself, whatever its scopes, and from any address, including one a live key isn't registered for. The answer is `204` whether the key worked, was already revoked or was never issued, so it never confirms that a key is real. To check, send any request with the key from one of your servers: `401` means it no longer works. Your other keys keep working, and a request the key started before you revoked it still finishes. Takes no body.



## OpenAPI

````yaml /openapi.json post /v1/keys/revoke
openapi: 3.1.0
info:
  title: Matamba Gateway
  version: '1'
  contact:
    name: Matamba Gateway partner support
    email: partners@matambaintelligence.com
    url: https://docs.matambaintelligence.com/support
  description: >-
    Open brokerage accounts for your customers, fund them from your wallet,
    place and track orders, and read each account's records at the broker.
    Amounts are integers in kobo, except the two average prices, which are
    decimal strings of kobo. Every error includes a `code` you can use in your
    logic. A list of values, such as an order state or an error `code`, can gain
    values: if you generate a client, have it accept values it doesn't know (in
    OpenAPI Generator, `enumUnknownDefaultCase`).
servers:
  - url: https://{host}
    description: The sandbox and live environments each have their own host and API keys.
    variables:
      host:
        default: sandbox-host.invalid
        description: We send you the host along with your API keys.
security:
  - bearer: []
tags:
  - name: Accounts
    description: The accounts you can trade for, and the broker's records for each one.
  - name: Orders
    description: >-
      Estimate, place, retrieve and cancel orders. We store each order before we
      send it to the exchange, and we send it only once.
  - name: Events
    description: >-
      Each change to your orders, applications and allocations creates an event.
      We send the same event bodies to your webhook endpoint. See
      [Webhooks](/webhooks) for how to verify them.
  - name: Applications
    description: Open a brokerage account for your customer.
  - name: Reference
    description: Code lists from the broker that you use in account applications.
  - name: Wallet
    description: >-
      Your wallet, and the allocations you make from it to your customers'
      accounts.
  - name: Limits
    description: >-
      What you may send: the limits on your requests and your day, and how much
      of each you've used.
  - name: Keys
    description: Revoke a key that has leaked, yourself, at any hour.
paths:
  /v1/keys/revoke:
    post:
      tags:
        - Keys
      summary: Revoke this key
      description: >-
        Ends the key you send in the `Authorization` header, at once. Use it the
        moment a key leaks, at any hour. Any key can revoke itself, whatever its
        scopes, and from any address, including one a live key isn't registered
        for. The answer is `204` whether the key worked, was already revoked or
        was never issued, so it never confirms that a key is real. To check,
        send any request with the key from one of your servers: `401` means it
        no longer works. Your other keys keep working, and a request the key
        started before you revoked it still finishes. Takes no body.
      operationId: revokeKey
      responses:
        '204':
          description: The key no longer works on this host, if it ever did. No body.
        '401':
          $ref: '#/components/responses/error.unauthorized'
          description: >-
            `unauthorized`: no key in the `Authorization` header, or a key for
            the other environment. Revoke that one at its own host. Nothing was
            revoked.
        '429':
          $ref: '#/components/responses/error.rate_limited'
          description: >-
            `rate_limited`: too many revocations from one address. Wait the
            `Retry-After` seconds, then send it again.
        '500':
          $ref: '#/components/responses/error.internal_error'
          description: '`internal_error`'
        '503':
          $ref: '#/components/responses/error.service_unavailable'
          description: '`service_unavailable`: the key may still work. Send it again.'
components:
  responses:
    error.unauthorized:
      description: 'An error: `unauthorized`.'
      headers:
        x-request-id:
          $ref: '#/components/headers/RequestId'
        Cache-Control:
          $ref: '#/components/headers/CacheControl'
        WWW-Authenticate:
          $ref: '#/components/headers/WWWAuthenticate'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            unauthorized:
              summary: unauthorized
              value:
                error:
                  type: authentication_error
                  code: unauthorized
                  message: Invalid credentials.
                  doc_url: https://docs.matambaintelligence.com/errors#unauthorized
    error.rate_limited:
      description: 'An error: `rate_limited`.'
      headers:
        x-request-id:
          $ref: '#/components/headers/RequestId'
        Cache-Control:
          $ref: '#/components/headers/CacheControl'
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            rate_limited:
              summary: rate_limited
              value:
                error:
                  type: rate_limit_error
                  code: rate_limited
                  message: >-
                    Too many requests. Nothing was done. Send the same request
                    again after the Retry-After interval.
                  doc_url: https://docs.matambaintelligence.com/errors#rate_limited
    error.internal_error:
      description: 'An error: `internal_error`.'
      headers:
        x-request-id:
          $ref: '#/components/headers/RequestId'
        Cache-Control:
          $ref: '#/components/headers/CacheControl'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            internal_error:
              summary: internal_error
              value:
                error:
                  type: api_error
                  code: internal_error
                  message: >-
                    The gateway encountered an internal error. Send the same
                    request again, exactly as you sent it.
                  doc_url: https://docs.matambaintelligence.com/errors#internal_error
    error.service_unavailable:
      description: 'An error: `service_unavailable`.'
      headers:
        x-request-id:
          $ref: '#/components/headers/RequestId'
        Cache-Control:
          $ref: '#/components/headers/CacheControl'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            service_unavailable:
              summary: service_unavailable
              value:
                error:
                  type: api_error
                  code: service_unavailable
                  message: >-
                    The gateway is temporarily unable to process this request.
                    Send the same request again, with the same Idempotency-Key
                    if it has one.
                  doc_url: >-
                    https://docs.matambaintelligence.com/errors#service_unavailable
  headers:
    RequestId:
      description: >-
        A unique identifier for this request. Include it when you [contact
        us](/support#report-a-problem).
      schema:
        type: string
    CacheControl:
      description: Always `no-store`.
      schema:
        type: string
        const: no-store
    WWWAuthenticate:
      description: 'Sent with 401: `Bearer realm="Matamba Gateway"`.'
      schema:
        type: string
    RetryAfter:
      description: >-
        The number of seconds to wait before you retry. Sent with `429
        rate_limited` (`1`), `503 settlement_lockout` (`60`) and `503
        trading_paused` (`60`).
      schema:
        type: integer
  schemas:
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - type
            - code
            - message
            - doc_url
          properties:
            type:
              type: string
              description: >-
                The category of the error. New values can be added: handle an
                unrecognised value with a safe default.
              enum:
                - authentication_error
                - invalid_request_error
                - idempotency_error
                - order_error
                - application_error
                - wallet_error
                - limit_error
                - rate_limit_error
                - permission_error
                - api_error
            code:
              type: string
              description: >-
                The error code. Use it in your logic; it doesn't change. New
                values can be added: handle an unrecognised value with a safe
                default.
              enum:
                - unauthorized
                - not_found
                - method_not_allowed
                - unsupported_media_type
                - request_too_large
                - invalid_request
                - missing_required_field
                - unknown_account
                - duplicate_order
                - order_not_found
                - account_not_found
                - exchange_unavailable
                - order_not_sent
                - order_rejected
                - similar_order_unresolved
                - order_not_cancelable
                - cancel_unconfirmed
                - settlement_lockout
                - account_not_at_broker
                - exchange_error
                - feature_not_enabled
                - insufficient_scope
                - application_rejected
                - duplicate_application
                - application_not_found
                - application_not_sent
                - wallet_too_low
                - allocation_rejected
                - duplicate_allocation
                - allocation_not_found
                - allocation_not_sent
                - similar_allocation_unresolved
                - rate_limited
                - unknown_symbol
                - limit_exceeded
                - service_unavailable
                - internal_error
                - trading_paused
                - outcome_not_recorded
            message:
              type: string
              description: >-
                A human-readable description of the error, for your logs. The
                wording can change.
            param:
              type: string
              description: >-
                The field, parameter or header that caused the error. Absent
                when the error isn't tied to a single field.
            reject_reason:
              type: string
              description: >-
                Why the exchange or broker rejected the request. Included with
                `order_rejected`, `application_rejected` and
                `allocation_rejected`, and takes the same values as the
                `reject_reason` field on the order, application or allocation.
            order:
              type: string
              description: >-
                The order the error is about, when it names one: the order that
                owns the `Idempotency-Key` for `duplicate_order`, the unresolved
                order for `similar_order_unresolved`, the order recorded for
                `order_rejected` and `order_not_sent`, and the order your
                request made for `outcome_not_recorded`.
              pattern: ^ord_[a-z2-7]{20}$
            application:
              type: string
              description: >-
                The application the error is about, when it names one: the one
                that owns the key for `duplicate_application`, the one recorded
                for `application_rejected` and `application_not_sent`, and the
                one your request made for `outcome_not_recorded`.
              pattern: ^app_[a-z2-7]{20}$
            allocation:
              type: string
              description: >-
                The allocation the error is about, when it names one: the one
                that owns the key for `duplicate_allocation`, the unresolved one
                for `similar_allocation_unresolved`, the one recorded for
                `allocation_rejected`, `allocation_not_sent` and
                `feature_not_enabled`, and the one your request made for
                `outcome_not_recorded`.
              pattern: ^alc_[a-z2-7]{20}$
            doc_url:
              type: string
              format: uri
              description: A link to the documentation for this error code.
          description: What went wrong, and the code to act on.
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: >-
        `Authorization: Bearer <key>`. Sandbox keys start with `mgw_test_` and
        live keys start with `mgw_live_`. Each key works only in its own
        environment, and a live key works only from the IP addresses or ranges
        registered for it.

````