Create a Credential
Stores a new upstream credential. The plaintext api_key (or
credentials object) is written to Barndoor’s encrypted secret store
and is never returned by any endpoint.
Choosing the auth method
Themodel_provider and auth_type together determine which fields are
required:
- API key (
auth_type: api_key) — passapi_keywith the upstream key. - AWS Bedrock IAM role (
auth_type: aws_role) — passcredentialswithiam_role_arnandexternal_id. UsePOST /admin/connections/aws-role-validateto confirm Barndoor can assume the role before saving. - Google Vertex (
auth_type: google_adc,google_service_account,google_impersonation) — for service accounts, pass the JSON key fields undercredentials. UsePOST /admin/connections/google-vertex-validateto confirm end-to-end access. - Anthropic OAuth passthrough — configured directly on a provider; this endpoint is not used for OAuth providers.
credentials JSON) is written to Barndoor’s encrypted
secret store and is never returned by any subsequent API call. Update or
rotate it later with PUT /admin/connections/{id}.
Example
Authorizations
JWT obtained through Barndoor's authentication flow. Pass the token
verbatim in Authorization: Bearer <token>. Use the Barndoor SDK's
loginInteractive() helper to obtain a token in scripts and notebooks.
Body
"OpenAI Production"
Slug of the upstream model provider this resource speaks to
openai, anthropic, azure_openai, google_ai, bedrock, vertex, groq, together, mistral, cohere, xai, fireworks, perplexity, openrouter, deepseek, custom "openai"
"https://api.openai.com/v1"
Optional. Defaults to the conventional auth type for the provider
(api_key for most vendors, aws_role for Bedrock, google_adc
for Vertex, etc.).
"api_key"
Plaintext upstream API key. Required when auth_type is api_key
(or any vendor-specific key flavor like bedrock_api_key). Not
required when auth_type is role- or service-account-based — pass
the role/SA fields under credentials instead.
"sk-xxxxxxxxxxxxxxxxxxxx"
Provider-specific credentials. Use this for non-API-key auth schemes (AWS keys, Google service-account JSON fields, Bedrock role+external_id). The shape mirrors what the provider expects; consult the corresponding How-To guide for each provider's required keys.
Non-secret provider settings (region, project_id, api_version, etc.).
Response
The newly created credential
A reusable upstream credential, called Credentials in the portal UI. One credential can back multiple providers (e.g. a single OpenAI key used by several routes).
"4f8b2a3c-12ee-4d92-9c7b-e7d2f8b0a111"
The organization that owns this credential
"OpenAI Production"
Slug of the upstream model provider this resource speaks to
openai, anthropic, azure_openai, google_ai, bedrock, vertex, groq, together, mistral, cohere, xai, fireworks, perplexity, openrouter, deepseek, custom "openai"
The authentication scheme this credential or provider uses to talk to
the upstream model provider. Valid values depend on model_provider:
for OpenAI/Anthropic-style vendors this is typically api_key; for AWS
Bedrock it is one of aws_role, aws_keys, or bedrock_api_key; for
Google Vertex it is google_adc, google_service_account, or
google_impersonation; Anthropic OAuth passthrough uses oauth_passthrough.
"api_key"
Upstream base URL the credential points at. Defaults to the public provider URL but can be overridden for self-hosted or proxy setups.
"https://api.openai.com/v1"
Provider-specific settings that aren't sensitive (e.g. AWS region, Vertex project id, Azure API version). Sensitive credentials live in the encrypted secret store and are never returned by the API.
{
"region": "us-east-1",
"model_api_family": "anthropic_messages"
}