Use an API key without exposing it
Let an AI agent call Stripe, GitHub or any HTTPS API with a key it never sees: store the key as a Dexto secret, limit it to exact hosts, and give it to an agent's sandbox.An agent that reads a web page can be talked into sending a key somewhere it shouldn’t. A Dexto secret avoids that: you store the key once with the exact hosts it may go to. The agent’s commands get a placeholder, and Dexto puts the real value on requests to those hosts only. Nothing returns the value: not the API, the CLI, the agent or its tools.
With the CLI
Section titled “With the CLI”Create the secret. The value comes from stdin or a prompt, never from an argument, so it stays out of shell history:
printf %s "$STRIPE_KEY" | dexto cloud secrets create STRIPE_KEY --host api.stripe.comdexto cloud secrets listIt is sent as Authorization: Bearer <value> by default. For an API that wants another header,
pass --header x-api-key, and --prefix "Token " when the value needs a prefix. Repeat --host for
up to 10 hosts.
Give it to an agent’s sandbox. Name the secret in the sandbox tool, in an agent file:
{ "name": "Billing helper", "instructions": "Answer questions about our Stripe account. Use curl in your sandbox.", "tools": [ { "type": "sandbox", "sandbox": { "type": "session", "size": "large" }, "secrets": ["STRIPE_KEY"] } ]}dexto cloud agents create --file agent.jsonEach command the agent runs has $STRIPE_KEY set to a placeholder, so
curl -H "Authorization: Bearer $STRIPE_KEY" https://api.stripe.com/v1/balance works unchanged.
Requests to any other host get only the placeholder.
Rotate the key without touching the agent:
printf %s "$NEW_STRIPE_KEY" | dexto cloud secrets update "$SECRET_ID" --valueWith MCP
Section titled “With MCP”dexto_cloud_secrets_list and dexto_cloud_secrets_get show secrets without their values.
Creating, changing and deleting a secret stay with the CLI and the API on purpose, so a value never
passes through a chat.
With the HTTP API
Section titled “With the HTTP API”printf %s "$STRIPE_KEY" | jq -Rs '{name: "STRIPE_KEY", value: ., hosts: ["api.stripe.com"], placement: {type: "bearer"}}' | curl -X POST https://api.dexto.ai/v1/secrets \ -H "Authorization: Bearer $DEXTO_API_KEY" \ -H "Content-Type: application/json" \ --data-binary @-The value goes through stdin, so it never appears in a command’s arguments, where other processes on the machine could read it.
See the Secrets API for header placement, MCP servers that use a secret, and the audit log.
Limits
Section titled “Limits”A project holds up to 100 secrets of up to 16 KiB each. A name is uppercase letters, digits and underscores. Storing secrets and the brokered sandbox traffic are free.