POST /v1/internal/credits/deposit
Handle credits deposit after payment
POST
/v1/internal/credits/deposit
Handle credits deposit after payment
Header Parameters
x-api-key
string
required
header
API key for authentication
Request Body required
Credits deposit payload
application/jsonOne of:
Option 1
Option 2
amountPaidCents
integer
optional payment validation
interval
string
from subscription metadata
orgId
string
REQUIRED
referenceId
string
REQUIRED
resetBeforeDeposit
boolean
default false = additive
source
string
REQUIRED
stripeCustomerId
string
from invoice.paid event
stripeSubscriptionId
string
from invoice.paid event
tier
string
REQUIRED
Responses
200
OK
application/jsonaiBalance
object
new
number
old
number
creditsInserted
boolean
cuBalance
object
new
number
old
number
400
Bad Request
401
Unauthorized
curl -X POST 'https://api.example.com/v1/internal/credits/deposit' \ -H 'Authorization: Bearer YOUR_API_TOKEN' \ -H 'x-api-key: string' \ -H 'Content-Type: application/json' \ -d '{}'
const response = await fetch('https://api.example.com/v1/internal/credits/deposit', { method: 'POST', headers: { "Authorization": "Bearer YOUR_API_TOKEN", "Content-Type": "application/json", "x-api-key": "string" }, body: JSON.stringify({})});const data = await response.json();console.log(data);
import requestsheaders = { 'Authorization': 'Bearer YOUR_API_TOKEN', 'x-api-key': 'string'}response = requests.post('https://api.example.com/v1/internal/credits/deposit', headers=headers, json={})print(response.json())
package mainimport ( "fmt" "io" "net/http" "strings")func main() { body := strings.NewReader(`{}`) req, _ := http.NewRequest("POST", "https://api.example.com/v1/internal/credits/deposit", body) req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN") req.Header.Set("Content-Type", "application/json") req.Header.Set("x-api-key", "string") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() result, _ := io.ReadAll(resp.Body) fmt.Println(string(result))}
200
Response
{ "aiBalance": { "new": 123, "old": 123 }, "creditsInserted": true, "cuBalance": { "new": 123, "old": 123 }}
API Playground
Try this endpoint
POST
/v1/internal/credits/deposit
