Save a customer AI key, encrypted in the vault (credentials.manage, recent authentication). The key is never shown again.
POST
/v1/orgs/{org}/ai-credentials
const url = 'https://api.replifier.com/v1/orgs/org_01hx0000000000000000000000/ai-credentials';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"provider":"anthropic","name":"example","secret":"example","brandId":"example","isDefault":true,"taskModels":{"assistant":"example","writing":"example","analysis":"example","short":"example","transcribe":"example"},"monthlyTokenCap":1,"taskCaps":{"compose":1,"design":1,"analyze":1,"assistant":1,"typo":1,"captions":1,"chapters":1,"summary":1,"personalization_sample":1,"test":1}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.replifier.com/v1/orgs/org_01hx0000000000000000000000/ai-credentials \ --header 'Content-Type: application/json' \ --data '{ "provider": "anthropic", "name": "example", "secret": "example", "brandId": "example", "isDefault": true, "taskModels": { "assistant": "example", "writing": "example", "analysis": "example", "short": "example", "transcribe": "example" }, "monthlyTokenCap": 1, "taskCaps": { "compose": 1, "design": 1, "analyze": 1, "assistant": 1, "typo": 1, "captions": 1, "chapters": 1, "summary": 1, "personalization_sample": 1, "test": 1 } }'Tests the key when saving it (lists the models it sees) and stores the result; if it fails it is left with status: error and the cause in check. The first key of a provider for the organization or the brand is the default. With brandId, that key takes precedence over the organization key. No Idempotency-Key: the request carries a secret.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”org
required
string
Example
org_01hx0000000000000000000000Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
provider
required
string
name
required
string
secret
required
string
brandId
string
isDefault
boolean
taskModels
object
assistant
string
writing
string
analysis
string
short
string
transcribe
string
monthlyTokenCap
integer
taskCaps
object
compose
integer
design
integer
analyze
integer
assistant
integer
typo
integer
captions
integer
chapters
integer
summary
integer
personalization_sample
integer
test
integer
Responses
Section titled “Responses”Key saved
Media typeapplication/json
object
credential
required
object
id
required
string
brandId
required
string
provider
required
string
name
required
string
last4
required
string
status
required
string
isDefault
required
boolean
modelsSeen
required
Array<string>
taskModels
required
object
key
additional properties
string
monthlyTokenCap
required
number
taskCaps
required
object
key
additional properties
number
usedTokensMonth
required
number
budgetWarning
required
boolean
lastCheckAt
required
string
lastCheck
required
object
ok
required
boolean
code
required
string
modelsCount
required
integer
createdBy
required
string
createdAt
required
string
check
required
object
ok
required
boolean
error
required
object
code
required
string
message
required
string
cause
required
string
fix
required
string
requestId
required
string
Example
{ "credential": { "provider": "anthropic", "status": "pending_approval" }}Invalid data
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
cause
required
string
fix
required
string
requestId
required
string
Example
{ "error": { "code": "not_found" }}No session, expired session, or invalid, expired or revoked API key
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
cause
required
string
fix
required
string
requestId
required
string
Example
{ "error": { "code": "not_found" }}Not allowed, API key missing the scope, IP not allowed, or request rejected (csrf_rejected)
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
cause
required
string
fix
required
string
requestId
required
string
Example
{ "error": { "code": "not_found" }}Does not exist or is not visible to you
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
cause
required
string
fix
required
string
requestId
required
string
Example
{ "error": { "code": "not_found" }}Internal error
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
cause
required
string
fix
required
string
requestId
required
string
Example
{ "error": { "code": "not_found" }}