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

# Delete API key

> Delete an API key.



## OpenAPI

````yaml delete /workspaces/{workspaceId}/api-keys/{apiKeyId}
openapi: 3.0.3
info:
  contact:
    email: support@openlayer.com
    name: Openlayer
    url: https://openlayer.com/
  description: API for interacting with the Openlayer server.
  title: Openlayer API
  version: '1.0'
  x-logo:
    url: https://logo.clearbit.com/openlayer.com
servers:
  - url: https://api.openlayer.com/v1
    description: Our prod backend
security:
  - bearerAuth: []
paths:
  /workspaces/{workspaceId}/api-keys/{apiKeyId}:
    delete:
      summary: Delete an API key
      description: Delete an API key.
      operationId: deleteApiKey
      parameters:
        - $ref: '#/components/parameters/workspaceId'
        - $ref: '#/components/parameters/apiKeyId'
      responses:
        '200':
          description: >-
            Key deleted. All of its secrets stop working immediately, including
            a previous secret still in its rotation grace period.
      x-codeSamples:
        - lang: python
          source: |
            from openlayer import Openlayer

            client = Openlayer()

            client.workspaces.api_keys.delete(
                "3f2b9c1e-8a4d-4e6f-9b7a-1c2d3e4f5a6b",
                workspace_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            )
        - lang: typescript
          source: >
            import Openlayer from 'openlayer';


            const client = new Openlayer();


            await
            client.workspaces.apiKeys.delete('3f2b9c1e-8a4d-4e6f-9b7a-1c2d3e4f5a6b',
            {
              workspaceId: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
            });
        - lang: go
          source: "package main\n\nimport (\n\t\"context\"\n\n\t\"github.com/openlayer-ai/openlayer-go\"\n)\n\nclient := openlayer.NewClient()\nerr := client.Workspaces.APIKeys.Delete(\n\tcontext.TODO(),\n\t\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n\t\"3f2b9c1e-8a4d-4e6f-9b7a-1c2d3e4f5a6b\",\n)\nif err != nil {\n\tpanic(err.Error())\n}\n"
        - lang: java
          source: >
            import com.openlayer.api.client.OpenlayerClient;

            import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient;

            import
            com.openlayer.api.models.workspaces.apikeys.ApiKeyDeleteParams;


            OpenlayerClient client = OpenlayerOkHttpClient.fromEnv();


            ApiKeyDeleteParams params = ApiKeyDeleteParams.builder()
                .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
                .apiKeyId("3f2b9c1e-8a4d-4e6f-9b7a-1c2d3e4f5a6b")
                .build();
            client.workspaces().apiKeys().delete(params);
        - lang: ruby
          source: |
            require "openlayer"

            openlayer = Openlayer::Client.new(api_key: ENV["OPENLAYER_API_KEY"])

            openlayer.workspaces.api_keys.delete(
              "3f2b9c1e-8a4d-4e6f-9b7a-1c2d3e4f5a6b",
              workspace_id: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
            )
        - lang: curl
          source: |
            curl --request DELETE \
              --url https://api.openlayer.com/v1/workspaces/182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e/api-keys/3f2b9c1e-8a4d-4e6f-9b7a-1c2d3e4f5a6b \
              --header 'Authorization: Bearer <token>'
components:
  parameters:
    workspaceId:
      name: workspaceId
      in: path
      description: The workspace id.
      required: true
      schema:
        type: string
        format: uuid
    apiKeyId:
      name: apiKeyId
      in: path
      description: The API key id.
      required: true
      schema:
        type: string
        format: uuid
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >
        Bearer authentication header of the form `Bearer <token>`, where
        `<token>` is your workspace API key. See [Find your API
        key](https://www.openlayer.com/docs/workspace-and-projects/find-your-api-key)
        for more information.

````