# Secrets Store # Stores ## List account stores `client.SecretsStore.Stores.List(ctx, params) (*V4PagePaginationArray[StoreListResponse], error)` **get** `/accounts/{account_id}/secrets_store/stores` Lists all the stores in an account ### Parameters - `params StoreListParams` - `AccountID param.Field[string]` Path param: Account Identifier - `Direction param.Field[StoreListParamsDirection]` Query param: Direction to sort objects - `const StoreListParamsDirectionAsc StoreListParamsDirection = "asc"` - `const StoreListParamsDirectionDesc StoreListParamsDirection = "desc"` - `Order param.Field[StoreListParamsOrder]` Query param: Order secrets by values in the given field - `const StoreListParamsOrderName StoreListParamsOrder = "name"` - `const StoreListParamsOrderComment StoreListParamsOrder = "comment"` - `const StoreListParamsOrderCreated StoreListParamsOrder = "created"` - `const StoreListParamsOrderModified StoreListParamsOrder = "modified"` - `const StoreListParamsOrderStatus StoreListParamsOrder = "status"` - `Page param.Field[int64]` Query param: Page number - `PerPage param.Field[int64]` Query param: Number of objects to return per page ### Returns - `type StoreListResponse struct{…}` - `ID string` Store Identifier - `Created Time` Whenthe secret was created. - `Modified Time` When the secret was modified. - `Name string` The name of the store ### Example ```go 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"), ) page, err := client.SecretsStore.Stores.List(context.TODO(), secrets_store.StoreListParams{ AccountID: cloudflare.F("985e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "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": "023e105f4ecef8ad9ca31a8372d0c353", "created": "2023-09-21T18:56:32.624632Z", "modified": "2023-09-21T18:56:32.624632Z", "name": "service_x_keys" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Create a store `client.SecretsStore.Stores.New(ctx, params) (*SinglePage[StoreNewResponse], error)` **post** `/accounts/{account_id}/secrets_store/stores` Creates a store in the account ### Parameters - `params StoreNewParams` - `AccountID param.Field[string]` Path param: Account Identifier - `Body param.Field[[]StoreNewParamsBody]` Body param - `Name string` The name of the store ### Returns - `type StoreNewResponse struct{…}` - `ID string` Store Identifier - `Created Time` Whenthe secret was created. - `Modified Time` When the secret was modified. - `Name string` The name of the store ### Example ```go 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"), ) page, err := client.SecretsStore.Stores.New(context.TODO(), secrets_store.StoreNewParams{ AccountID: cloudflare.F("985e105f4ecef8ad9ca31a8372d0c353"), Body: []secrets_store.StoreNewParamsBody{secrets_store.StoreNewParamsBody{ Name: cloudflare.F("service_x_keys"), }}, }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "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": "023e105f4ecef8ad9ca31a8372d0c353", "created": "2023-09-21T18:56:32.624632Z", "modified": "2023-09-21T18:56:32.624632Z", "name": "service_x_keys" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Delete a store `client.SecretsStore.Stores.Delete(ctx, storeID, body) (*StoreDeleteResponse, error)` **delete** `/accounts/{account_id}/secrets_store/stores/{store_id}` Deletes a single store ### Parameters - `storeID string` Store Identifier - `body StoreDeleteParams` - `AccountID param.Field[string]` Account Identifier ### Returns - `type StoreDeleteResponse struct{…}` - `ID string` Store Identifier - `Created Time` Whenthe secret was created. - `Modified Time` When the secret was modified. - `Name string` The name of the store ### Example ```go 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"), ) store, err := client.SecretsStore.Stores.Delete( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", secrets_store.StoreDeleteParams{ AccountID: cloudflare.F("985e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", store.ID) } ``` #### Response ```json { "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": "023e105f4ecef8ad9ca31a8372d0c353", "created": "2023-09-21T18:56:32.624632Z", "modified": "2023-09-21T18:56:32.624632Z", "name": "service_x_keys" }, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` # Secrets ## List store secrets `client.SecretsStore.Stores.Secrets.List(ctx, storeID, params) (*V4PagePaginationArray[StoreSecretListResponse], error)` **get** `/accounts/{account_id}/secrets_store/stores/{store_id}/secrets` Lists all store secrets ### Parameters - `storeID string` Store Identifier - `params StoreSecretListParams` - `AccountID param.Field[string]` Path param: Account Identifier - `Direction param.Field[StoreSecretListParamsDirection]` Query param: Direction to sort objects - `const StoreSecretListParamsDirectionAsc StoreSecretListParamsDirection = "asc"` - `const StoreSecretListParamsDirectionDesc StoreSecretListParamsDirection = "desc"` - `Order param.Field[StoreSecretListParamsOrder]` Query param: Order secrets by values in the given field - `const StoreSecretListParamsOrderName StoreSecretListParamsOrder = "name"` - `const StoreSecretListParamsOrderComment StoreSecretListParamsOrder = "comment"` - `const StoreSecretListParamsOrderCreated StoreSecretListParamsOrder = "created"` - `const StoreSecretListParamsOrderModified StoreSecretListParamsOrder = "modified"` - `const StoreSecretListParamsOrderStatus StoreSecretListParamsOrder = "status"` - `Page param.Field[int64]` Query param: Page number - `PerPage param.Field[int64]` Query param: Number of objects to return per page - `Scopes param.Field[[][]string]` Query param: Only secrets with the given scopes will be returned - `Search param.Field[string]` Query param: Search secrets using a filter string, filtering across name and comment ### Returns - `type StoreSecretListResponse struct{…}` - `ID string` Secret identifier tag. - `Created Time` Whenthe secret was created. - `Modified Time` When the secret was modified. - `Name string` The name of the secret - `Status StoreSecretListResponseStatus` - `const StoreSecretListResponseStatusPending StoreSecretListResponseStatus = "pending"` - `const StoreSecretListResponseStatusActive StoreSecretListResponseStatus = "active"` - `const StoreSecretListResponseStatusDeleted StoreSecretListResponseStatus = "deleted"` - `StoreID string` Store Identifier - `Comment string` Freeform text describing the secret ### Example ```go 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"), ) page, err := client.SecretsStore.Stores.Secrets.List( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", secrets_store.StoreSecretListParams{ AccountID: cloudflare.F("985e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "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 } } ``` ## Get a secret by ID `client.SecretsStore.Stores.Secrets.Get(ctx, storeID, secretID, query) (*StoreSecretGetResponse, error)` **get** `/accounts/{account_id}/secrets_store/stores/{store_id}/secrets/{secret_id}` Returns details of a single secret ### Parameters - `storeID string` Store Identifier - `secretID string` Secret identifier tag. - `query StoreSecretGetParams` - `AccountID param.Field[string]` Account Identifier ### Returns - `type StoreSecretGetResponse struct{…}` - `ID string` Secret identifier tag. - `Created Time` Whenthe secret was created. - `Modified Time` When the secret was modified. - `Name string` The name of the secret - `Status StoreSecretGetResponseStatus` - `const StoreSecretGetResponseStatusPending StoreSecretGetResponseStatus = "pending"` - `const StoreSecretGetResponseStatusActive StoreSecretGetResponseStatus = "active"` - `const StoreSecretGetResponseStatusDeleted StoreSecretGetResponseStatus = "deleted"` - `StoreID string` Store Identifier - `Comment string` Freeform text describing the secret ### Example ```go 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.Get( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "3fd85f74b32742f1bff64a85009dda07", secrets_store.StoreSecretGetParams{ AccountID: cloudflare.F("985e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", secret.ID) } ``` #### Response ```json { "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 } } ``` ## Create a secret `client.SecretsStore.Stores.Secrets.New(ctx, storeID, params) (*SinglePage[StoreSecretNewResponse], error)` **post** `/accounts/{account_id}/secrets_store/stores/{store_id}/secrets` Creates a secret in the account ### Parameters - `storeID string` Store Identifier - `params StoreSecretNewParams` - `AccountID param.Field[string]` Path param: Account Identifier - `Body param.Field[[]StoreSecretNewParamsBody]` Body param - `Name string` The name of the secret - `Scopes []string` The list of services that can use this secret. - `Value string` The value of the secret. Note that this is 'write only' - no API reponse will provide this value, it is only used to create/modify secrets. - `Comment string` Freeform text describing the secret ### Returns - `type StoreSecretNewResponse struct{…}` - `ID string` Secret identifier tag. - `Created Time` Whenthe secret was created. - `Modified Time` When the secret was modified. - `Name string` The name of the secret - `Status StoreSecretNewResponseStatus` - `const StoreSecretNewResponseStatusPending StoreSecretNewResponseStatus = "pending"` - `const StoreSecretNewResponseStatusActive StoreSecretNewResponseStatus = "active"` - `const StoreSecretNewResponseStatusDeleted StoreSecretNewResponseStatus = "deleted"` - `StoreID string` Store Identifier - `Comment string` Freeform text describing the secret ### Example ```go 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"), ) page, err := client.SecretsStore.Stores.Secrets.New( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", secrets_store.StoreSecretNewParams{ AccountID: cloudflare.F("985e105f4ecef8ad9ca31a8372d0c353"), Body: []secrets_store.StoreSecretNewParamsBody{secrets_store.StoreSecretNewParamsBody{ Name: cloudflare.F("MY_API_KEY"), Scopes: cloudflare.F([]string{"workers", "ai_gateway", "dex", "access"}), Value: cloudflare.F("api-token-secret-123"), }}, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "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 } } ``` ## Patch a secret `client.SecretsStore.Stores.Secrets.Edit(ctx, storeID, secretID, params) (*StoreSecretEditResponse, error)` **patch** `/accounts/{account_id}/secrets_store/stores/{store_id}/secrets/{secret_id}` Updates a single secret ### Parameters - `storeID string` Store Identifier - `secretID string` Secret identifier tag. - `params StoreSecretEditParams` - `AccountID param.Field[string]` Path param: Account Identifier - `Comment param.Field[string]` Body param: Freeform text describing the secret - `Scopes param.Field[[]string]` Body param: The list of services that can use this secret. ### Returns - `type StoreSecretEditResponse struct{…}` - `ID string` Secret identifier tag. - `Created Time` Whenthe secret was created. - `Modified Time` When the secret was modified. - `Name string` The name of the secret - `Status StoreSecretEditResponseStatus` - `const StoreSecretEditResponseStatusPending StoreSecretEditResponseStatus = "pending"` - `const StoreSecretEditResponseStatusActive StoreSecretEditResponseStatus = "active"` - `const StoreSecretEditResponseStatusDeleted StoreSecretEditResponseStatus = "deleted"` - `StoreID string` Store Identifier - `Comment string` Freeform text describing the secret ### Example ```go 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"), ) response, err := client.SecretsStore.Stores.Secrets.Edit( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "3fd85f74b32742f1bff64a85009dda07", secrets_store.StoreSecretEditParams{ AccountID: cloudflare.F("985e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.ID) } ``` #### Response ```json { "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 } } ``` ## 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 ### Parameters - `storeID string` Store Identifier - `secretID string` Secret identifier tag. - `body StoreSecretDeleteParams` - `AccountID param.Field[string]` Account Identifier ### Returns - `type StoreSecretDeleteResponse struct{…}` - `ID string` Secret identifier tag. - `Created Time` Whenthe secret was created. - `Modified Time` When the secret was modified. - `Name string` The name of the secret - `Status StoreSecretDeleteResponseStatus` - `const StoreSecretDeleteResponseStatusPending StoreSecretDeleteResponseStatus = "pending"` - `const StoreSecretDeleteResponseStatusActive StoreSecretDeleteResponseStatus = "active"` - `const StoreSecretDeleteResponseStatusDeleted StoreSecretDeleteResponseStatus = "deleted"` - `StoreID string` Store Identifier - `Comment string` Freeform text describing the secret ### Example ```go 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) } ``` #### Response ```json { "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 } } ``` ## Delete secrets `client.SecretsStore.Stores.Secrets.BulkDelete(ctx, storeID, body) (*SinglePage[StoreSecretBulkDeleteResponse], error)` **delete** `/accounts/{account_id}/secrets_store/stores/{store_id}/secrets` Deletes one or more secrets ### Parameters - `storeID string` Store Identifier - `body StoreSecretBulkDeleteParams` - `AccountID param.Field[string]` Account Identifier ### Returns - `type StoreSecretBulkDeleteResponse struct{…}` - `ID string` Secret identifier tag. - `Created Time` Whenthe secret was created. - `Modified Time` When the secret was modified. - `Name string` The name of the secret - `Status StoreSecretBulkDeleteResponseStatus` - `const StoreSecretBulkDeleteResponseStatusPending StoreSecretBulkDeleteResponseStatus = "pending"` - `const StoreSecretBulkDeleteResponseStatusActive StoreSecretBulkDeleteResponseStatus = "active"` - `const StoreSecretBulkDeleteResponseStatusDeleted StoreSecretBulkDeleteResponseStatus = "deleted"` - `StoreID string` Store Identifier - `Comment string` Freeform text describing the secret ### Example ```go 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"), ) page, err := client.SecretsStore.Stores.Secrets.BulkDelete( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", secrets_store.StoreSecretBulkDeleteParams{ AccountID: cloudflare.F("985e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "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 } } ``` ## Duplicate Secret `client.SecretsStore.Stores.Secrets.Duplicate(ctx, storeID, secretID, params) (*StoreSecretDuplicateResponse, error)` **post** `/accounts/{account_id}/secrets_store/stores/{store_id}/secrets/{secret_id}/duplicate` Duplicates the secret, keeping the value ### Parameters - `storeID string` Store Identifier - `secretID string` Secret identifier tag. - `params StoreSecretDuplicateParams` - `AccountID param.Field[string]` Path param: Account Identifier - `Name param.Field[string]` Body param: The name of the secret - `Scopes param.Field[[]string]` Body param: The list of services that can use this secret. - `Comment param.Field[string]` Body param: Freeform text describing the secret ### Returns - `type StoreSecretDuplicateResponse struct{…}` - `ID string` Secret identifier tag. - `Created Time` Whenthe secret was created. - `Modified Time` When the secret was modified. - `Name string` The name of the secret - `Status StoreSecretDuplicateResponseStatus` - `const StoreSecretDuplicateResponseStatusPending StoreSecretDuplicateResponseStatus = "pending"` - `const StoreSecretDuplicateResponseStatusActive StoreSecretDuplicateResponseStatus = "active"` - `const StoreSecretDuplicateResponseStatusDeleted StoreSecretDuplicateResponseStatus = "deleted"` - `StoreID string` Store Identifier - `Comment string` Freeform text describing the secret ### Example ```go 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"), ) response, err := client.SecretsStore.Stores.Secrets.Duplicate( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "3fd85f74b32742f1bff64a85009dda07", secrets_store.StoreSecretDuplicateParams{ AccountID: cloudflare.F("985e105f4ecef8ad9ca31a8372d0c353"), Name: cloudflare.F("MY_API_KEY"), Scopes: cloudflare.F([]string{"workers", "ai_gateway", "dex", "access"}), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.ID) } ``` #### Response ```json { "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 } } ``` # Quota ## View secret usage `client.SecretsStore.Quota.Get(ctx, query) (*QuotaGetResponse, error)` **get** `/accounts/{account_id}/secrets_store/quota` Lists the number of secrets used in the account. ### Parameters - `query QuotaGetParams` - `AccountID param.Field[string]` Account Identifier ### Returns - `type QuotaGetResponse struct{…}` - `Secrets QuotaGetResponseSecrets` - `Quota float64` The number of secrets the account is entitlted to use - `Usage float64` The number of secrets the account is currently using ### Example ```go 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"), ) quota, err := client.SecretsStore.Quota.Get(context.TODO(), secrets_store.QuotaGetParams{ AccountID: cloudflare.F("985e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", quota.Secrets) } ``` #### Response ```json { "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": { "secrets": { "quota": 10, "usage": 10 } }, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ```