Skip to main content
POST
Create a secret
Stores a new credential for the workspace. The anthropic and openai types are auto-configured, while generic secrets need injection details. See LLMs for LLM keys, then grant the secret to an agent. Creates a workspace secret. The gateway uses secrets to inject credentials into outbound requests matching the host and path patterns.
  • anthropic and openai types are auto-configured (an openai value that is a full connection string also sets the host).
  • generic type requires an injectionConfig.
  • Instead of an inline value, set valueSource to onepassword and provide opRef; the gateway resolves the value at request time through the workspace’s 1Password vault connection.
A new secret is attached to every agent in the workspace automatically (attachedAgents); adjust with the Grants endpoints.
Availability: Cloud · Community (self-hosted) · Enterprise (self-hosted)

Authorizations

Authorization
string
header
required

A workspace API key (oc_…) or organization API key (oc_org_…). Workspace-scoped endpoints called with an organization key also need X-Workspace-Id.

Body

application/json
name
string
required
Required string length: 1 - 255
Example:

"Anthropic Production"

type
enum<string>
required
Available options:
anthropic,
openai,
generic
hostPattern
string
required

Hostname pattern to match (no ://, /, or spaces). A * wildcard must stand for whole labels and the pattern must end in a literal domain that is not a public suffix (*.example.com is fine, *.com is not).

Example:

"api.anthropic.com"

valueSource
enum<string>
default:inline
Available options:
inline,
onepassword
value
string

The secret value (API key, token, and so on). Required unless valueSource is onepassword.

Required string length: 1 - 10000
opRef
string

1Password secret reference (op://vault/item/field). Required when valueSource is onepassword.

opDisplay
object

Human-readable labels of the picked 1Password vault/item/field, for display only.

pathPattern
string

Optional path pattern to match.

Maximum string length: 1000
injectionConfig
Header injection · object

How the gateway injects this secret into matching outbound requests (generic secrets only). Exactly one variant:

  • Header — { "headerName": "Authorization", "valueFormat": "Bearer {value}" }
  • Query parameter — { "paramName": "key", "paramFormat": "{value}" }
  • URL path template — { "pathTemplate": "/bot{value}" } (must start with / and contain {value} exactly once)
  • URL path regex — { "pathRegex": "^/bot([^/]+)", "pathReplacement": "/bot{value}" } (replacement must contain {value})

Unknown or mixed keys are rejected.

Response

Secret created

The narrowed secret representation returned by create endpoints.

id
string
name
string
type
string
valueSource
enum<string>
Available options:
inline,
onepassword
opRef
string | null
hostPattern
string
pathPattern
string | null
createdAt
string<date-time>
preview
string

Masked preview of the value (inline secrets only).

attachedAgents
string[]

Agent ids the new secret was granted to automatically (workspace secrets only; empty for organization secrets).