---
updatedAt: 2026-04-28T19:09:15.000Z
agentTools:
  projectIndex: https://docs.rainforestpay.com/llms.txt
---

# Disable API key

Disable an API key.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Authentication",
    "version": "1.0.0",
    "description": "This resource is used for authentication actions",
    "contact": {
      "name": "Rainforest",
      "email": "support@rainforestpay.com",
      "url": "https://rainforestpay.com"
    }
  },
  "servers": [
    {
      "url": "https://api.sandbox.rainforestpay.com",
      "description": "Sandbox server"
    },
    {
      "url": "https://api.rainforestpay.com",
      "description": "Production server"
    }
  ],
  "paths": {
    "/v1/api_keys": {
      "get": {
        "operationId": "list_api_keys",
        "summary": "List API keys",
        "description": "Query a list of API keys.",
        "parameters": [
          {
            "in": "header",
            "name": "Rainforest-Api-Version",
            "schema": {
              "type": "string",
              "default": "2024-10-16",
              "enum": [
                "2024-10-16",
                "2023-12-01"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "description": "Status of the request.\n\nIf the request status code is 2XX, then the `status` will be `SUCCESS`. If the request status code is 4XX or 5XX, then the `status` will be `ERROR`.",
                      "type": "string",
                      "enum": [
                        "SUCCESS",
                        "ERROR"
                      ],
                      "example": "SUCCESS"
                    },
                    "data": {
                      "allOf": [
                        {
                          "type": "object",
                          "properties": {
                            "total_results": {
                              "type": "integer",
                              "description": "Total number of results available. This value will be -1 if the query parameter `omit_total_results` is set to true."
                            }
                          }
                        },
                        {
                          "type": "object",
                          "properties": {
                            "results": {
                              "description": "List of API keys.",
                              "type": "array",
                              "items": {
                                "$ref": "#/paths/~1v1~1api_keys/post/requestBody/content/application~1json/schema"
                              }
                            }
                          }
                        }
                      ]
                    },
                    "errors": {
                      "description": "List of errors, if applicable.",
                      "type": "array",
                      "items": {
                        "type": "object",
                        "description": "Details of the error.",
                        "properties": {
                          "field": {
                            "description": "The field in the request that had an error, if applicable.",
                            "type": "string"
                          },
                          "code": {
                            "description": "The code describing the error.",
                            "type": "string"
                          },
                          "message": {
                            "description": "The description of the error related to the field.",
                            "type": "string"
                          }
                        }
                      },
                      "example": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request, check for validation errors.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Default response object.",
                  "type": "object",
                  "properties": {
                    "status": {
                      "$ref": "#/paths/~1v1~1api_keys/get/responses/200/content/application~1json/schema/properties/status"
                    },
                    "data": {
                      "description": "Generic data object specified per resource, null if there are request errors.",
                      "type": "object",
                      "example": null,
                      "nullable": true,
                      "readOnly": true
                    },
                    "errors": {
                      "$ref": "#/paths/~1v1~1api_keys/get/responses/200/content/application~1json/schema/properties/errors"
                    }
                  }
                },
                "example": {
                  "status": "ERROR",
                  "data": null,
                  "errors": [
                    {
                      "field": "string",
                      "code": "RequestBody",
                      "message": "Invalid request payload"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Authorization missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1v1~1api_keys/get/responses/400/content/application~1json/schema"
                },
                "example": {
                  "status": "ERROR",
                  "data": null,
                  "errors": [
                    {
                      "field": "string",
                      "code": "AuthUnauthorized",
                      "message": "Unauthorized"
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Authorization insufficient for requested action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1v1~1api_keys/get/responses/400/content/application~1json/schema"
                },
                "example": {
                  "status": "ERROR",
                  "data": null,
                  "errors": [
                    {
                      "field": "string",
                      "code": "AuthForbidden",
                      "message": "Forbidden"
                    }
                  ]
                }
              }
            }
          },
          "5XX": {
            "description": "Unexpected error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1v1~1api_keys/get/responses/400/content/application~1json/schema"
                },
                "example": {
                  "status": "ERROR",
                  "data": null,
                  "errors": [
                    {
                      "field": "string",
                      "code": "string",
                      "message": "Internal Server Error"
                    }
                  ]
                }
              }
            }
          }
        },
        "tags": [
          "API Keys"
        ]
      }
    },
    "/v1/api_keys/{api_key_id}": {
      "get": {
        "operationId": "get_api_key",
        "summary": "Get API key",
        "description": "Get API key details by the API key ID.",
        "parameters": [
          {
            "$ref": "#/paths/~1v1~1api_keys/get/parameters/0"
          },
          {
            "in": "path",
            "required": true,
            "name": "api_key_id",
            "schema": {
              "type": "string"
            },
            "description": "The unique API key identifier. \n\nPrefix is \"api\" in production and \"sbx_api\" in sandbox.",
            "examples": {
              "production": {
                "value": "api_2DrDU206kzAhclm1WrZbuwDERRk"
              },
              "sandbox": {
                "value": "sbx_api_2DrDU206kzAhclm1WrZbuwDERRk"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "status": {
                      "$ref": "#/paths/~1v1~1api_keys/get/responses/200/content/application~1json/schema/properties/status"
                    },
                    "data": {
                      "$ref": "#/paths/~1v1~1api_keys/post/requestBody/content/application~1json/schema"
                    },
                    "errors": {
                      "$ref": "#/paths/~1v1~1api_keys/get/responses/200/content/application~1json/schema/properties/errors"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/paths/~1v1~1api_keys/get/responses/400"
          },
          "401": {
            "$ref": "#/paths/~1v1~1api_keys/get/responses/401"
          },
          "403": {
            "$ref": "#/paths/~1v1~1api_keys/get/responses/403"
          },
          "404": {
            "$ref": "#/paths/~1v1~1sessions/delete/responses/404"
          },
          "5XX": {
            "$ref": "#/paths/~1v1~1api_keys/get/responses/5XX"
          }
        },
        "tags": [
          "API Keys"
        ]
      }
    },
    "/v1/api_keys/{api_key_id}/disable": {
      "post": {
        "operationId": "disable_api_key",
        "summary": "Disable API key",
        "description": "Disable an API key.",
        "parameters": [
          {
            "$ref": "#/paths/~1v1~1api_keys/get/parameters/0"
          },
          {
            "$ref": "#/paths/~1v1~1api_keys~1{api_key_id}/get/parameters/1",
            "in": "path"
          }
        ],
        "responses": {
          "204": {
            "description": "OK"
          },
          "400": {
            "$ref": "#/paths/~1v1~1api_keys/get/responses/400"
          },
          "401": {
            "$ref": "#/paths/~1v1~1api_keys/get/responses/401"
          },
          "403": {
            "$ref": "#/paths/~1v1~1api_keys/get/responses/403"
          },
          "404": {
            "$ref": "#/paths/~1v1~1sessions/delete/responses/404"
          },
          "5XX": {
            "$ref": "#/paths/~1v1~1api_keys/get/responses/5XX"
          }
        },
        "tags": [
          "API Keys"
        ]
      }
    },
    "/v1/sessions": {
      "delete": {
        "operationId": "delete_session",
        "summary": "Delete session",
        "description": "Delete a temporary session, permanently invalidating it.",
        "parameters": [
          {
            "$ref": "#/paths/~1v1~1api_keys/get/parameters/0"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "session_id": {
                    "description": "The unique session identifier. \n\nPrefix is \"ses\" in production and \"sbx_ses\" in sandbox.",
                    "type": "string",
                    "example": "ses_2DrDU206kzAhclm1WrZbuwDERRk"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "OK"
          },
          "400": {
            "$ref": "#/paths/~1v1~1api_keys/get/responses/400"
          },
          "401": {
            "$ref": "#/paths/~1v1~1api_keys/get/responses/401"
          },
          "403": {
            "$ref": "#/paths/~1v1~1api_keys/get/responses/403"
          },
          "404": {
            "description": "Resource not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/paths/~1v1~1api_keys/get/responses/400/content/application~1json/schema"
                },
                "example": {
                  "status": "ERROR",
                  "data": null,
                  "errors": [
                    {
                      "field": "string",
                      "code": "EntityNotFound",
                      "message": "Resource not found"
                    }
                  ]
                }
              }
            }
          },
          "5XX": {
            "$ref": "#/paths/~1v1~1api_keys/get/responses/5XX"
          }
        },
        "tags": [
          "Sessions"
        ]
      }
    }
  },
  "tags": [
    {
      "name": "API Keys",
      "description": "Resources for api key functions."
    },
    {
      "name": "Sessions",
      "description": "Resources for session functions."
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "APIKey"
      }
    }
  },
  "security": [
    {
      "BearerAuth": []
    }
  ]
}
```