Skip to main content
POST
/
validate
Validate an API key
curl --request POST \
  --url https://integration.smartpng.com/api/validate \
  --header 'Content-Type: application/json' \
  --data '
{
  "api_key": "sp_live_abc123def456ghi789"
}
'
{
  "valid": true,
  "user_id": "2ef2a1c4-0b73-4fd8-b065-418f79b4fd7c",
  "subscription_type": "Paid",
  "credits_remaining": 500,
  "max_image_size": 10485760
}

Overview

Use this endpoint as a lightweight preflight check before sending compression requests.

Notes

  • The request body is JSON.
  • The endpoint returns whether the key is valid, the current balance, and the maximum allowed file size.
  • This endpoint does not consume credits.

Body

application/json
api_key
string
required

SmartPNG API key

Example:

"sp_live_abc123def456ghi789"

Response

API key is valid

valid
boolean
required
Example:

true

user_id
string
required

SmartPNG user identifier

Example:

"2ef2a1c4-0b73-4fd8-b065-418f79b4fd7c"

subscription_type
enum<string>
required
Available options:
Free,
Paid
Example:

"Paid"

credits_remaining
integer
required

Remaining free and paid credits

Example:

500

max_image_size
integer
required

Maximum upload size in bytes

Example:

10485760