Supply Credential API
Batch-add and manage provider API keys, Bedrock roles, and Vertex service-account JSON from a script or agent.
On this page
The Supply Credential API is the small automation surface for route suppliers. One owner-scoped API accepts official provider API keys, delegated AWS Bedrock IAM roles, and Google Vertex service-account JSON.
A Supplier Token can use only this control API. It is separate from an AnyPath Gateway API Key, cannot invoke a model, and never grants Admin or Operator access.
Create a Supplier Token
Open Console → Routes → Supply Credentials, create a Supplier Token, and copy it immediately. The plaintext is shown once; AnyPath stores only its hash.
export ANYPATH_CONTROL_URL="https://anypath.dev"
export ANYPATH_SUPPLIER_TOKEN="ap_supply_..."
Every machine request uses the same header:
Authorization: Bearer ap_supply_...
Content-Type: application/json
Do not use a Gateway API Key (sk-...) here. Do not use a Supplier Token on model endpoints.
Batch-add credentials
POST /api/gateway/p2p/supply-credentials accepts up to 100 items. New and restored items are validated automatically unless validate is explicitly false. Each item succeeds or fails independently.
Provider API keys
curl "$ANYPATH_CONTROL_URL/api/gateway/p2p/supply-credentials" \
-H "Authorization: Bearer $ANYPATH_SUPPLIER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"items": [
{"kind":"api_key","preset":"anthropic-console","value":"provider-key-1"},
{"kind":"api_key","preset":"openai-api-key","value":"provider-key-2"}
]
}'
For AWS Claude Platform, use the same api_key kind with the aws-claude-platform preset and include awsRegion plus workspaceId.
Vertex service-account JSON
Use gemini-vertex for Gemini or anthropic-vertex for Claude on Vertex:
{
"items": [
{
"kind": "vertex_json",
"preset": "gemini-vertex",
"location": "us-central1",
"serviceAccountJson": {
"type": "service_account",
"project_id": "example-project",
"client_email": "supplier@example-project.iam.gserviceaccount.com",
"private_key": "<service-account-private-key>",
"token_uri": "https://oauth2.googleapis.com/token"
}
}
]
}
The private key is encrypted at ingestion and is never returned. Batch upload uses multiple vertex_json items, one service account per item.
Bedrock delegated role
Bedrock roles use a short two-step trust setup before ingestion.
- Preview the exact trust and permission policies:
curl "$ANYPATH_CONTROL_URL/api/gateway/p2p/aws/assume-role" \
-H "Authorization: Bearer $ANYPATH_SUPPLIER_TOKEN" \
-H "Content-Type: application/json" \
-d '{"action":"preview","roleArn":"arn:aws:iam::123456789012:role/AnyPathBedrock"}'
- Apply both returned policies in AWS, then repeat the request with
"action":"verify". A successful STS boundary check returns a short-livedproof. - Add the role:
{
"items": [
{
"kind": "bedrock_role",
"preset": "anthropic-bedrock",
"roleArn": "arn:aws:iam::123456789012:role/AnyPathBedrock",
"region": "us-east-1",
"proof": "v1..."
}
]
}
AnyPath stores the role ARN and account-scoped trust metadata, not long-lived IAM keys or temporary STS credentials.
Manage credentials
| Operation | Endpoint |
|---|---|
| List masked credentials | GET /api/gateway/p2p/supply-credentials |
| Add or batch-add | POST /api/gateway/p2p/supply-credentials |
| Enable or disable | PATCH /api/gateway/p2p/supply-credentials/{id} with {"enabled":true} or false |
| Revalidate | POST /api/gateway/p2p/supply-credentials/{id}/validate |
| Remove | DELETE /api/gateway/p2p/supply-credentials/{id} |
List responses contain only a masked hint, provider, credential kind, models, state, and validation evidence. They never contain the provider secret or Vertex JSON.
Agent pattern
An agent does not need a dedicated MCP server. Give it the control URL, inject a Supplier Token through its secret environment, and provide this HTTP contract. A safe loop is: list current credentials, batch-add missing items, inspect every item result, then disable or remove only the returned owner-scoped IDs.
Repeated ingestion of the same owner, preset, and credential is idempotent. A removed credential can be added again and is restored through the same fail-closed validation path.
Security and routing state
- Credentials are encrypted before storage and redacted from all responses.
- A new, restored, or re-enabled credential is not routeable until validation and the existing pricing and settlement gates pass.
- A failed provider call leaves the credential in
failedstate; it does not silently open the route. - Revoking a Supplier Token immediately blocks further requests made with that token.
- Supplier Tokens cannot manage another user’s credentials, create Gateway API Keys, invoke models, or access Admin APIs.
For provider and model contracts, see the Supplier guide.