API Keys

Buckets and Environments

Applies to
Gatewayruntime for API, AI, and MCP gateways
Hosting
Managed EdgeManaged DedicatedSelf-Hosted

API keys are stored in "buckets," which organize and isolate authentication credentials across different environments. Learn more in the API Key API documentation.

Default bucket configuration

Zuplo automatically creates three buckets for each project:

  • Production: Stores API keys for the production environment (your default Git branch)
  • Preview: Stores API keys shared across all preview environments (non-default Git branches)
  • Development: Stores API keys for the development (working copy) environment

For more information on how environments relate to Git branches, see Branch-Based Deployments.

Bucket identifiers

Every bucket has an ID that starts with bckt_, and a name. Use the bucket ID whenever you identify a bucket, both in the Zuplo Developer API and in policy configuration. To copy it, open Services → API Keys → Consumers in the Zuplo Portal and select the environment with the Dev / Preview / Prod switcher. The Bucket ID pill sits beside the environment badge under the API Key Service heading, with a copy button.

Deprecated

The bucket name is a legacy identifier. The Zuplo Portal doesn't display it, and the Developer API accepts it only for backward compatibility on the consumer, key, and manager endpoints. Pass the bucket ID instead.

Three endpoints are the exception and still require the bucket name:

  • GET /v1/accounts/{accountName}/key-buckets/{bucketName}
  • PATCH /v1/accounts/{accountName}/key-buckets/{bucketName}
  • DELETE /v1/accounts/{accountName}/key-buckets/{bucketName}

Custom bucket configuration

To use a custom bucket, specify its bucketId in your API Key policy options:

JSONCode
{ "export": "ApiKeyInboundPolicy", "module": "$import(@zuplo/runtime)", "options": { "bucketId": "bckt_2HaK3odRyJle6NJSu8mzNKBC30BYxllxL", "allowUnauthenticatedRequests": false } }

For more information about finding a bucket ID, see Bucket identifiers.

When the configuration sets no bucket, the policy uses the default bucket for the current environment.

The policy's bucketName option is deprecated. Policies that set it keep working, but the runtime logs a warning — use bucketId instead.

Creating custom buckets

Create custom buckets using the API Key management API. See the create buckets endpoint for details.

The following example creates a bucket for a QA environment. The response includes the new bucket's id, which is the value to set as bucketId on the policy:

TerminalCode
curl --request POST \ --url https://dev.zuplo.com/v1/accounts/YOUR_ACCOUNT_NAME/key-buckets \ --header 'Authorization: Bearer YOUR_ZAPI_KEY' \ --header 'Content-Type: application/json' \ --data '{"name":"contoso-qa-bucket","description":"API Key bucket for QA Environment"}'

Replace YOUR_ACCOUNT_NAME with your account name and YOUR_ZAPI_KEY with your Zuplo API key.

Last modified on