Endpoint
Authentication
Requires a developer API key in theAuthorization header.
Request Headers
| Header | Value |
|---|---|
Authorization | Bearer <api_key> |
Content-Type | application/json |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
principalId | string | Yes | The principal (end-user) who owns this credential |
service | string | Yes | Service identifier (e.g. "github", "slack", "google") |
accessToken | string | Yes | The access token to store (encrypted at rest) |
credentialType | string | No | Credential type (default "oauth2") |
refreshToken | string | No | Optional refresh token (encrypted at rest) |
tokenExpiresAt | string | No | ISO-8601 expiry timestamp for the access token |
metadata | object | No | Arbitrary metadata (e.g. scopes, account info) |
Example Request
Response — 201 Created
Response Fields
| Field | Type | Description |
|---|---|---|
id | string | Unique vault credential ID |
principalId | string | The principal who owns this credential |
service | string | Service identifier |
credentialType | string | Credential type |
createdAt | string | ISO-8601 creation timestamp |
If a credential already exists for the same
(developerId, principalId, service) combination, it will be updated (upsert behavior). The raw access token and refresh token are never returned in any response — they are stored encrypted and only retrievable via the Exchange endpoint.Error Responses
| Status | Code | Description |
|---|---|---|
| 400 | BAD_REQUEST | Missing principalId, service, or accessToken |
| 401 | UNAUTHORIZED | Invalid or missing API key |