Credits
GET
/v1/credits
This endpoint is for listing your credits.
Request Example
curl -X GET 'https://api.stablecog.com/v1/credits' \
-H 'Authorization: Bearer <YOUR_STABLECOG_API_KEY>' \
-H 'Content-Type: application/json'
const API_KEY = process.env.STABLECOG_API_KEY;
const API_HOST = 'https://api.stablecog.com';
const API_ENDPOINT = '/v1/credits';
const API_URL = `${API_HOST}${ENDPOINT}`;
const res = await fetch(API_URL,
headers: {
Authorization: `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
}
);
const resJSON = await res.json();
console.log(resJSON);
import os
import requests
API_KEY = os.getenv('STABLECOG_API_KEY')
API_HOST = 'https://api.stablecog.com'
API_ENDPOINT = '/v1/credits'
API_URL = f'{API_HOST}{API_ENDPOINT}'
headers = {
'Authorization': f'Bearer {API_KEY}',
'Content-Type': 'application/json'
}
response = requests.get(API_URL, headers=headers)
res_json = response.json()
print(json.dumps(res_json, indent=2))
Response
{
"total_remaining_credits": 1391,
"credits": [
{
"id": "0ea24c34-4d0b-4e67-8495-d16fa4d19ba6",
"remaining_amount": 0,
"expires_at": "2100-01-01T05:00:00Z",
"type": {
"id": "3b12b23e-478b-4c18-8e34-70b3f0af1ee6",
"name": "Free",
"amount": 100,
"description": "Base free credits for user."
}
},
{
"id": "dca9aee0-0571-4d0a-9f66-5c9ef675bf16",
"remaining_amount": 1391,
"expires_at": "2100-01-01T05:00:00Z",
"type": {
"id": "65c30ce5-1c9f-4db7-b459-917058bd318a",
"name": "Gift XLarge",
"amount": 1500,
"description": "XLarge gift pack."
}
}
]
}
Request Headers
Authorization required
string
Authorization: Bearer <YOUR_STABLECOG_API_KEY>
.Response Body
total_remaining_credits
int
credits
array of TCredit