User Credits
Get user credit balance.
Get Credits
Endpoint
GET ${baseUrl}/users/credits
Response
interface UserCreditsResponse {
success: boolean
creditsBalance: number
}
Add Credits
Endpoint
POST ${baseUrl}/users/credits
Request Body
interface AddCreditsRequest {
amount: number
}
Response
interface AddCreditsResponse {
success: boolean
transactionId: string
paymentMethod: string
cc_last4: string
}
Example Request
const response = await fetch('${baseUrl}/users/credits', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Basic YOUR_API_KEY',
},
body: JSON.stringify({
amount: 100,
}),
})
const data = await response.json()
Error Codes
Status Code | Description |
---|---|
200 | Success |
400 | Invalid Request Body |
401 | Unauthorized |
403 | Forbidden |
500 | Server Error |