Skip to main content
SocialCutter

API and development

Process images with the API from the terminal (curl)

Hands-on guide to the SocialCutter API with curl: health, credentials, platforms, processing by URL and by file, history, wallet and common errors.

  • curl
  • API
  • SocialCutter
  • terminal
  • jq
  • process images
  • API key

Before you start

You need curl and jq. Store the base URL and the key in variables so you do not repeat them:

export API_URL="https://api.socialcutter.theboomer.dev"
export API_KEY="sc_your_key"

The full reference lives at https://docs.socialcutter.theboomer.dev.

1. Get the API key

Open https://dash.socialcutter.theboomer.dev, go to Profile → API keys and create a key. It starts with sc_, is shown only once, and only one key can be active per account. If you create another without revoking the first, the API returns 400.

2. Check health and credentials

# Health: public endpoint, no key needed
curl -s "$API_URL/api/v1/health" | jq

# Identity of the account using the key
curl -s "$API_URL/api/v1/auth/me" -H "X-API-Key: $API_KEY" | jq

# Available uses
curl -s "$API_URL/api/v1/credits" -H "X-API-Key: $API_KEY" | jq

/api/v1/health returns the service status, version, uptime and database connectivity. /api/v1/auth/me confirms which account the key belongs to. If that call returns 401, the key is wrong or revoked.

3. List platforms, formats and fit modes

# Response shape: top-level keys first
curl -s "$API_URL/api/v1/platforms" | jq 'keys'

# Every platform with its formats, sizes and aspect ratio
curl -s "$API_URL/api/v1/platforms" | jq

# Output formats and fit modes
curl -s "$API_URL/api/v1/formats" | jq
curl -s "$API_URL/api/v1/fit-modes" | jq

/platforms, /formats and /fit-modes are public. Start with jq 'keys' to see the real response shape, then drill into it with the path you need.

These are the combinations destinations accepts:

PlatformFormatSizeAspect ratio
instagrampost1080x10801:1
instagramstory1080x19209:16
instagramlandscape1080x5661.91:1
facebookpost1200x6301.91:1
facebookstory1080x19209:16
facebookcover820x3122.63:1
twitterpost1200x67516:9
twitterheader1500x5003:1
linkedinpost1200x6271.91:1
linkedincover1128x1915.9:1
youtubethumbnail1280x72016:9
youtubebanner2560x144016:9
tiktokcover1080x19209:16

4. Process an image by URL

curl -s -X POST "$API_URL/api/v1/images/process" \
  -H "X-API-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: demo-001" \
  -d '{
    "source": { "type": "url", "value": "https://example.com/photo.jpg" },
    "destinations": [
      { "platform": "instagram", "format": "post" },
      { "platform": "tiktok", "format": "cover" }
    ]
  }' | jq

source says where the image comes from (url or base64) and destinations is the list of platform and format you want. The Idempotency-Key header makes retries safe; without it the API generates a random key per request.

5. Process a local file

curl -s -X POST "$API_URL/api/v1/images/process/upload" \
  -H "X-API-Key: $API_KEY" \
  -F "file=@./photo.jpg" \
  -F 'destinations=[{"platform":"linkedin","format":"post"},{"platform":"youtube","format":"thumbnail"}]' | jq

In multipart the file goes in file and destinations is a JSON string in a form field. The limit is 5 MB; above that the API returns 413.

Base64 alternative

POST /api/v1/images/upload takes the image as a base64 string in the JSON body, with no file and no source URL. Use it only when the image has no reachable public URL.

6. Read the response and download a result

The response carries image_id and an outputs list, one entry per destination, with the result URL, the platform, the format and the dimensions.

# Save the response to a file
curl -s -X POST "$API_URL/api/v1/images/process" \
  -H "X-API-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "source": { "type": "url", "value": "https://example.com/photo.jpg" },
    "destinations": [{ "platform": "instagram", "format": "post" }]
  }' > out.json

# Id, platform and format of each output
jq '.image_id, (.outputs[] | {url, platform, format})' out.json

# Download the first result
curl -s -o result.webp "$(jq -r '.outputs[0].url' out.json)"

If a dimension key is missing, print the whole object with jq '.outputs[0]' to see its real shape.

7. History and wallet

# Last 10 images
curl -s "$API_URL/api/v1/history?limit=10" -H "X-API-Key: $API_KEY" | jq

# Only the ones created from the API
curl -s "$API_URL/api/v1/history?origin=api&limit=10" -H "X-API-Key: $API_KEY" | jq

# Wallet: daily quota, used, remaining, bonus bag and purchased balance
curl -s "$API_URL/api/v1/wallet" -H "X-API-Key: $API_KEY" | jq

limit accepts 1 to 100 (default 50) and skip paginates. The origin filter separates browser (dashboard) from api.

8. Choose the fit mode

fit_mode controls how the image fits each format:

ModeBehaviour
coverScales and crops the excess with a centered crop. This is the default.
containFits the whole image and pads with background_color.
fillStretches the image.
stretchForces the exact dimensions.
curl -s -X POST "$API_URL/api/v1/images/process" \
  -H "X-API-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "source": { "type": "url", "value": "https://example.com/photo.jpg" },
    "destinations": [{ "platform": "facebook", "format": "cover" }],
    "options": { "fit_mode": "contain", "format": "webp", "quality": 85 }
  }' | jq

The cover crop is centered. In options you can also set format (webp, png, jpg, gif) and quality (1 to 100, default 85).

Retries, batches and pagination

  • Reuse the same Idempotency-Key header when you retry a request: the API will not process it twice.
  • POST /api/v1/images/batch processes several images in one call and reports the result per index. Failed items are refunded.
  • GET /api/v1/history paginates with limit (1 to 100) and skip.
  • Every response carries the X-Tentpole-Version header with the running build version.

Cost

  • 1 use per destination (platform and format) per request.
  • Duplicate destinations in the same request are not charged twice.
  • Failed processing is refunded.

Common errors

CodeMeaning
400Invalid payload: unknown platform, format or fit mode, malformed JSON, or a key already active
401Missing, malformed, expired or revoked credentials
404Resource not found (image or file id)
413The file is over 5 MB
422Request validation error
429Wallet quota exhausted
500Processing failure; the uses for that request are refunded

Next steps

Frequently asked questions

Where do I get the API key?

In the dashboard, under Profile → API keys. It starts with sc_, is shown only once, and only one key can be active per account.

How do I send the key on each request?

With the header X-API-Key: sc_... (preferred) or Authorization: Bearer sc_.... Public endpoints such as /api/v1/health and /api/v1/platforms need no key.

What is the difference between processing by URL and by file?

POST /api/v1/images/process takes a JSON body with source (URL or base64) and destinations. POST /api/v1/images/process/upload takes the real file as multipart, with no base64 round-trip, up to 5 MB.

How is processing billed?

1 use per destination, meaning each platform and format pair. Duplicate destinations in the same request are not charged twice, and failed items are refunded.

How do I change the crop behaviour?

With fit_mode in options. cover (default) scales and crops the excess with a centered crop, contain fits the whole image with padding, fill stretches it and stretch forces the exact dimensions.