Skip to main content
POST
/
api
/
credentials
curl --request POST \
  --url http://localhost:3000/api/v1/credentials \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "name": "OpenAI Production",
    "provider": "openai",
    "apiKey": "sk-...",
    "credentialType": "api_key",
    "baseUrl": null,
    "proxy": false,
    "isValid": true
  }'
{
  "success": true,
  "message": "Credential created successfully",
  "credentialId": "cred_123abc"
}

Body Parameters

name
string
Credential name or model name for Ollama
provider
string
required
Provider name (e.g., openai, anthropic, ollama)
apiKey
string
required
API key for the provider
credentialType
string
required
Type of credential
baseUrl
string | null
Optional base URL for the provider
dynamicFields
object
Additional dynamic fields
proxy
boolean
Whether to use proxy
isValid
boolean
Validation status

Response

success
boolean
Indicates if the credential was created successfully
message
string
Success or error message
credentialId
string
The ID of the newly created credential
curl --request POST \
  --url http://localhost:3000/api/v1/credentials \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "name": "OpenAI Production",
    "provider": "openai",
    "apiKey": "sk-...",
    "credentialType": "api_key",
    "baseUrl": null,
    "proxy": false,
    "isValid": true
  }'
{
  "success": true,
  "message": "Credential created successfully",
  "credentialId": "cred_123abc"
}

Notes

  • For Ollama provider, credentials manage models within a single credential
  • The name field can represent the credential name or model name for Ollama
  • Ensure the API key is valid before creating the credential
  • The system checks for existing valid credentials for the same provider