# Stores ## List account stores `secrets_store.stores.list(StoreListParams**kwargs) -> SyncV4PagePaginationArray[StoreListResponse]` **get** `/accounts/{account_id}/secrets_store/stores` Lists all the stores in an account ### Parameters - `account_id: str` Account Identifier - `direction: Optional[Literal["asc", "desc"]]` Direction to sort objects - `"asc"` - `"desc"` - `order: Optional[Literal["name", "comment", "created", 2 more]]` Order secrets by values in the given field - `"name"` - `"comment"` - `"created"` - `"modified"` - `"status"` - `page: Optional[int]` Page number - `per_page: Optional[int]` Number of objects to return per page ### Returns - `class StoreListResponse: …` - `id: str` Store Identifier - `created: datetime` Whenthe secret was created. - `modified: datetime` When the secret was modified. - `name: str` The name of the store ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) page = client.secrets_store.stores.list( account_id="985e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.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 } } ``` ## Create a store `secrets_store.stores.create(StoreCreateParams**kwargs) -> SyncSinglePage[StoreCreateResponse]` **post** `/accounts/{account_id}/secrets_store/stores` Creates a store in the account ### Parameters - `account_id: str` Account Identifier - `body: Iterable[Body]` - `name: str` The name of the store ### Returns - `class StoreCreateResponse: …` - `id: str` Store Identifier - `created: datetime` Whenthe secret was created. - `modified: datetime` When the secret was modified. - `name: str` The name of the store ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) page = client.secrets_store.stores.create( account_id="985e105f4ecef8ad9ca31a8372d0c353", body=[{ "name": "service_x_keys" }], ) page = page.result[0] print(page.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 } } ``` ## Delete a store `secrets_store.stores.delete(strstore_id, StoreDeleteParams**kwargs) -> StoreDeleteResponse` **delete** `/accounts/{account_id}/secrets_store/stores/{store_id}` Deletes a single store ### Parameters - `account_id: str` Account Identifier - `store_id: str` Store Identifier ### Returns - `class StoreDeleteResponse: …` - `id: str` Store Identifier - `created: datetime` Whenthe secret was created. - `modified: datetime` When the secret was modified. - `name: str` The name of the store ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) store = client.secrets_store.stores.delete( store_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="985e105f4ecef8ad9ca31a8372d0c353", ) print(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 } } ``` ## Domain Types ### Store List Response - `class StoreListResponse: …` - `id: str` Store Identifier - `created: datetime` Whenthe secret was created. - `modified: datetime` When the secret was modified. - `name: str` The name of the store ### Store Create Response - `class StoreCreateResponse: …` - `id: str` Store Identifier - `created: datetime` Whenthe secret was created. - `modified: datetime` When the secret was modified. - `name: str` The name of the store ### Store Delete Response - `class StoreDeleteResponse: …` - `id: str` Store Identifier - `created: datetime` Whenthe secret was created. - `modified: datetime` When the secret was modified. - `name: str` The name of the store # Secrets ## List store secrets `secrets_store.stores.secrets.list(strstore_id, SecretListParams**kwargs) -> SyncV4PagePaginationArray[SecretListResponse]` **get** `/accounts/{account_id}/secrets_store/stores/{store_id}/secrets` Lists all store secrets ### Parameters - `account_id: str` Account Identifier - `store_id: str` Store Identifier - `direction: Optional[Literal["asc", "desc"]]` Direction to sort objects - `"asc"` - `"desc"` - `order: Optional[Literal["name", "comment", "created", 2 more]]` Order secrets by values in the given field - `"name"` - `"comment"` - `"created"` - `"modified"` - `"status"` - `page: Optional[int]` Page number - `per_page: Optional[int]` Number of objects to return per page - `scopes: Optional[Iterable[SequenceNotStr[str]]]` Only secrets with the given scopes will be returned - `search: Optional[str]` Search secrets using a filter string, filtering across name and comment ### Returns - `class SecretListResponse: …` - `id: str` Secret identifier tag. - `created: datetime` Whenthe secret was created. - `modified: datetime` When the secret was modified. - `name: str` The name of the secret - `status: Literal["pending", "active", "deleted"]` - `"pending"` - `"active"` - `"deleted"` - `store_id: str` Store Identifier - `comment: Optional[str]` Freeform text describing the secret ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) page = client.secrets_store.stores.secrets.list( store_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="985e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.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 } } ``` ## Get a secret by ID `secrets_store.stores.secrets.get(strsecret_id, SecretGetParams**kwargs) -> SecretGetResponse` **get** `/accounts/{account_id}/secrets_store/stores/{store_id}/secrets/{secret_id}` Returns details of a single secret ### Parameters - `account_id: str` Account Identifier - `store_id: str` Store Identifier - `secret_id: str` Secret identifier tag. ### Returns - `class SecretGetResponse: …` - `id: str` Secret identifier tag. - `created: datetime` Whenthe secret was created. - `modified: datetime` When the secret was modified. - `name: str` The name of the secret - `status: Literal["pending", "active", "deleted"]` - `"pending"` - `"active"` - `"deleted"` - `store_id: str` Store Identifier - `comment: Optional[str]` Freeform text describing the secret ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) secret = client.secrets_store.stores.secrets.get( secret_id="3fd85f74b32742f1bff64a85009dda07", account_id="985e105f4ecef8ad9ca31a8372d0c353", store_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 `secrets_store.stores.secrets.create(strstore_id, SecretCreateParams**kwargs) -> SyncSinglePage[SecretCreateResponse]` **post** `/accounts/{account_id}/secrets_store/stores/{store_id}/secrets` Creates a secret in the account ### Parameters - `account_id: str` Account Identifier - `store_id: str` Store Identifier - `body: Iterable[Body]` - `name: str` The name of the secret - `scopes: SequenceNotStr[str]` The list of services that can use this secret. - `value: str` 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: Optional[str]` Freeform text describing the secret ### Returns - `class SecretCreateResponse: …` - `id: str` Secret identifier tag. - `created: datetime` Whenthe secret was created. - `modified: datetime` When the secret was modified. - `name: str` The name of the secret - `status: Literal["pending", "active", "deleted"]` - `"pending"` - `"active"` - `"deleted"` - `store_id: str` Store Identifier - `comment: Optional[str]` Freeform text describing the secret ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) page = client.secrets_store.stores.secrets.create( store_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="985e105f4ecef8ad9ca31a8372d0c353", body=[{ "name": "MY_API_KEY", "scopes": ["workers", "ai_gateway", "dex", "access"], "value": "api-token-secret-123", }], ) page = page.result[0] print(page.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 } } ``` ## Patch a secret `secrets_store.stores.secrets.edit(strsecret_id, SecretEditParams**kwargs) -> SecretEditResponse` **patch** `/accounts/{account_id}/secrets_store/stores/{store_id}/secrets/{secret_id}` Updates a single secret ### Parameters - `account_id: str` Account Identifier - `store_id: str` Store Identifier - `secret_id: str` Secret identifier tag. - `comment: Optional[str]` Freeform text describing the secret - `scopes: Optional[SequenceNotStr[str]]` The list of services that can use this secret. ### Returns - `class SecretEditResponse: …` - `id: str` Secret identifier tag. - `created: datetime` Whenthe secret was created. - `modified: datetime` When the secret was modified. - `name: str` The name of the secret - `status: Literal["pending", "active", "deleted"]` - `"pending"` - `"active"` - `"deleted"` - `store_id: str` Store Identifier - `comment: Optional[str]` Freeform text describing the secret ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) response = client.secrets_store.stores.secrets.edit( secret_id="3fd85f74b32742f1bff64a85009dda07", account_id="985e105f4ecef8ad9ca31a8372d0c353", store_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 `secrets_store.stores.secrets.delete(strsecret_id, SecretDeleteParams**kwargs) -> SecretDeleteResponse` **delete** `/accounts/{account_id}/secrets_store/stores/{store_id}/secrets/{secret_id}` Deletes a single secret ### Parameters - `account_id: str` Account Identifier - `store_id: str` Store Identifier - `secret_id: str` Secret identifier tag. ### Returns - `class SecretDeleteResponse: …` - `id: str` Secret identifier tag. - `created: datetime` Whenthe secret was created. - `modified: datetime` When the secret was modified. - `name: str` The name of the secret - `status: Literal["pending", "active", "deleted"]` - `"pending"` - `"active"` - `"deleted"` - `store_id: str` Store Identifier - `comment: Optional[str]` Freeform text describing the secret ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) secret = client.secrets_store.stores.secrets.delete( secret_id="3fd85f74b32742f1bff64a85009dda07", account_id="985e105f4ecef8ad9ca31a8372d0c353", store_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 `secrets_store.stores.secrets.bulk_delete(strstore_id, SecretBulkDeleteParams**kwargs) -> SyncSinglePage[SecretBulkDeleteResponse]` **delete** `/accounts/{account_id}/secrets_store/stores/{store_id}/secrets` Deletes one or more secrets ### Parameters - `account_id: str` Account Identifier - `store_id: str` Store Identifier ### Returns - `class SecretBulkDeleteResponse: …` - `id: str` Secret identifier tag. - `created: datetime` Whenthe secret was created. - `modified: datetime` When the secret was modified. - `name: str` The name of the secret - `status: Literal["pending", "active", "deleted"]` - `"pending"` - `"active"` - `"deleted"` - `store_id: str` Store Identifier - `comment: Optional[str]` Freeform text describing the secret ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) page = client.secrets_store.stores.secrets.bulk_delete( store_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="985e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.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 } } ``` ## Duplicate Secret `secrets_store.stores.secrets.duplicate(strsecret_id, SecretDuplicateParams**kwargs) -> SecretDuplicateResponse` **post** `/accounts/{account_id}/secrets_store/stores/{store_id}/secrets/{secret_id}/duplicate` Duplicates the secret, keeping the value ### Parameters - `account_id: str` Account Identifier - `store_id: str` Store Identifier - `secret_id: str` Secret identifier tag. - `name: str` The name of the secret - `scopes: SequenceNotStr[str]` The list of services that can use this secret. - `comment: Optional[str]` Freeform text describing the secret ### Returns - `class SecretDuplicateResponse: …` - `id: str` Secret identifier tag. - `created: datetime` Whenthe secret was created. - `modified: datetime` When the secret was modified. - `name: str` The name of the secret - `status: Literal["pending", "active", "deleted"]` - `"pending"` - `"active"` - `"deleted"` - `store_id: str` Store Identifier - `comment: Optional[str]` Freeform text describing the secret ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) response = client.secrets_store.stores.secrets.duplicate( secret_id="3fd85f74b32742f1bff64a85009dda07", account_id="985e105f4ecef8ad9ca31a8372d0c353", store_id="023e105f4ecef8ad9ca31a8372d0c353", name="MY_API_KEY", scopes=["workers", "ai_gateway", "dex", "access"], ) print(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 } } ``` ## Domain Types ### Secret List Response - `class SecretListResponse: …` - `id: str` Secret identifier tag. - `created: datetime` Whenthe secret was created. - `modified: datetime` When the secret was modified. - `name: str` The name of the secret - `status: Literal["pending", "active", "deleted"]` - `"pending"` - `"active"` - `"deleted"` - `store_id: str` Store Identifier - `comment: Optional[str]` Freeform text describing the secret ### Secret Get Response - `class SecretGetResponse: …` - `id: str` Secret identifier tag. - `created: datetime` Whenthe secret was created. - `modified: datetime` When the secret was modified. - `name: str` The name of the secret - `status: Literal["pending", "active", "deleted"]` - `"pending"` - `"active"` - `"deleted"` - `store_id: str` Store Identifier - `comment: Optional[str]` Freeform text describing the secret ### Secret Create Response - `class SecretCreateResponse: …` - `id: str` Secret identifier tag. - `created: datetime` Whenthe secret was created. - `modified: datetime` When the secret was modified. - `name: str` The name of the secret - `status: Literal["pending", "active", "deleted"]` - `"pending"` - `"active"` - `"deleted"` - `store_id: str` Store Identifier - `comment: Optional[str]` Freeform text describing the secret ### Secret Edit Response - `class SecretEditResponse: …` - `id: str` Secret identifier tag. - `created: datetime` Whenthe secret was created. - `modified: datetime` When the secret was modified. - `name: str` The name of the secret - `status: Literal["pending", "active", "deleted"]` - `"pending"` - `"active"` - `"deleted"` - `store_id: str` Store Identifier - `comment: Optional[str]` Freeform text describing the secret ### Secret Delete Response - `class SecretDeleteResponse: …` - `id: str` Secret identifier tag. - `created: datetime` Whenthe secret was created. - `modified: datetime` When the secret was modified. - `name: str` The name of the secret - `status: Literal["pending", "active", "deleted"]` - `"pending"` - `"active"` - `"deleted"` - `store_id: str` Store Identifier - `comment: Optional[str]` Freeform text describing the secret ### Secret Bulk Delete Response - `class SecretBulkDeleteResponse: …` - `id: str` Secret identifier tag. - `created: datetime` Whenthe secret was created. - `modified: datetime` When the secret was modified. - `name: str` The name of the secret - `status: Literal["pending", "active", "deleted"]` - `"pending"` - `"active"` - `"deleted"` - `store_id: str` Store Identifier - `comment: Optional[str]` Freeform text describing the secret ### Secret Duplicate Response - `class SecretDuplicateResponse: …` - `id: str` Secret identifier tag. - `created: datetime` Whenthe secret was created. - `modified: datetime` When the secret was modified. - `name: str` The name of the secret - `status: Literal["pending", "active", "deleted"]` - `"pending"` - `"active"` - `"deleted"` - `store_id: str` Store Identifier - `comment: Optional[str]` Freeform text describing the secret