GET
/
api
/
v1
/
generate
/
credit
Get Remaining Credits
curl --request GET \
  --url https://api.sunoapi.org/api/v1/generate/credit \
  --header 'Authorization: Bearer <token>'
{
  "code": 200,
  "msg": "success",
  "data": 100
}

Usage Guide

  • Credits are consumed when generating music, lyrics, or using other processing features.
  • This endpoint allows you to check your current credit balance before initiating tasks.
  • Returns a single integer value representing your available credits.
  • No parameters required; authentication via API key is sufficient.

Developer Notes

  1. Monitor your credit balance regularly to avoid service interruptions.
  2. If credits are insufficient, generation tasks will fail with error code 429.
  3. Consider integrating this check before starting expensive generation operations.
  4. This endpoint is lightweight and can be called frequently as needed.

Authorizations

Authorization
string
header
required

🔑 API Authentication

All endpoints require authentication using Bearer Token.

Get API Key

  1. Visit the API Key Management Page to obtain your API Key

Usage

Add to request headers:

Authorization: Bearer YOUR_API_KEY

⚠️ Note:

  • Keep your API Key secure and do not share it with others
  • If you suspect your API Key has been compromised, reset it immediately from the management page

Response

Request successful

code
enum<integer>

Status Codes

  • ✅ 200 - Request successful
  • ⚠️ 400 - Invalid parameters
  • ⚠️ 401 - Unauthorized access
  • ⚠️ 404 - Invalid request method or path
  • ⚠️ 405 - Rate limit exceeded
  • ⚠️ 413 - Theme or prompt too long
  • ⚠️ 429 - Insufficient credits
  • ⚠️ 430 - Your call frequency is too high. Please try again later.
  • ⚠️ 455 - System maintenance
  • ❌ 500 - Server error
Available options:
200,
400,
401,
404,
405,
413,
429,
430,
455,
500
Example:

200

msg
string

Error message when code != 200

Example:

"success"

data
integer

The number of credits currently available in your account.

  • Each API operation consumes a specific number of credits depending on the feature.
  • Additional credits can be purchased from your account dashboard.
Example:

100