Skip to content
Start here

Delete a secret

client.SecretsStore.Stores.Secrets.Delete(ctx, storeID, secretID, body) (*StoreSecretDeleteResponse, error)
DELETE/accounts/{account_id}/secrets_store/stores/{store_id}/secrets/{secret_id}

Deletes a single secret

Security

API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Secrets Store Write
ParametersExpand Collapse
storeID string

Store Identifier

maxLength32
secretID string

Secret identifier tag.

maxLength32
body StoreSecretDeleteParams
AccountID param.Field[string]

Account Identifier

maxLength32
ReturnsExpand Collapse
type StoreSecretDeleteResponse struct{…}
ID string

Secret identifier tag.

maxLength32
Created Time

Whenthe secret was created.

formatdate-time
Modified Time

When the secret was modified.

formatdate-time
Name string

The name of the secret

Status StoreSecretDeleteResponseStatus
One of the following:
const StoreSecretDeleteResponseStatusPending StoreSecretDeleteResponseStatus = "pending"
const StoreSecretDeleteResponseStatusActive StoreSecretDeleteResponseStatus = "active"
const StoreSecretDeleteResponseStatusDeleted StoreSecretDeleteResponseStatus = "deleted"
StoreID string

Store Identifier

maxLength32
Comment stringoptional

Freeform text describing the secret

Delete a secret

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/option"
  "github.com/cloudflare/cloudflare-go/secrets_store"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
    option.WithAPIEmail("user@example.com"),
  )
  secret, err := client.SecretsStore.Stores.Secrets.Delete(
    context.TODO(),
    "023e105f4ecef8ad9ca31a8372d0c353",
    "3fd85f74b32742f1bff64a85009dda07",
    secrets_store.StoreSecretDeleteParams{
      AccountID: cloudflare.F("985e105f4ecef8ad9ca31a8372d0c353"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", secret.ID)
}
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "id": "3fd85f74b32742f1bff64a85009dda07",
    "created": "2023-09-21T18:56:32.624632Z",
    "modified": "2023-09-21T18:56:32.624632Z",
    "name": "MY_API_KEY",
    "status": "pending",
    "store_id": "023e105f4ecef8ad9ca31a8372d0c353",
    "comment": "info about my secret"
  },
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "id": "3fd85f74b32742f1bff64a85009dda07",
    "created": "2023-09-21T18:56:32.624632Z",
    "modified": "2023-09-21T18:56:32.624632Z",
    "name": "MY_API_KEY",
    "status": "pending",
    "store_id": "023e105f4ecef8ad9ca31a8372d0c353",
    "comment": "info about my secret"
  },
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000
  }
}