DocsUsersCredits

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 CodeDescription
200Success
400Invalid Request Body
401Unauthorized
403Forbidden
500Server Error