Skip to content
Menu

Inkly API guide

Pass Inkly a message and a US mailing address. Each request creates one card, paid from your account's prepaid credits, ready to be written and mailed.

Jump to setup
On this page

1. Create and check your API key

Sign in to Integrations in your dashboard. Select Create API key, name your key, and select Create key. Copy the key when it appears; it is shown only once. Keep it on your server, out of browser code and public repositories.

Replace YOUR_API_KEY with the complete key, including its inkly_sk_ prefix. All endpoints use the same authorization header. Check your connection without creating an order:

Shell
curl "https://swuhcvokawzzttaambde.supabase.co/functions/v1/inkly-api/me" \
  -H "Authorization: Bearer YOUR_API_KEY"

A successful GET /me returns name, email, balance_cents, and the formatted balance. Add credits in the dashboard's Credits section before sending.

2. Choose a card and handwriting style

Fetch the available options with GET /catalog:

Shell
curl "https://swuhcvokawzzttaambde.supabase.co/functions/v1/inkly-api/catalog" \
  -H "Authorization: Bearer YOUR_API_KEY"

The response contains designs with id, name, and desc, plus styles with id, name, and tone. Use the IDs in your send request. Logo cards are not available through the API.

3. Send one card

Save this payload as card.json. Replace each uppercase value with your chosen catalog IDs, message, and recipient details.

card.json
{
  "card_design": "YOUR_CARD_DESIGN_ID",
  "handwriting_style": "YOUR_HANDWRITING_STYLE_ID",
  "message": "YOUR_CARD_MESSAGE",
  "recipient": {
    "first_name": "RECIPIENT_FIRST_NAME",
    "last_name": "RECIPIENT_LAST_NAME",
    "address1": "RECIPIENT_STREET_ADDRESS",
    "city": "RECIPIENT_CITY",
    "state": "TWO_LETTER_STATE_CODE",
    "zip": "RECIPIENT_ZIP_CODE"
  }
}

Sending this request places an order and charges your credits. Use a unique event ID for YOUR_UNIQUE_EVENT_ID, such as the ID of the order or deal that triggered the card.

Shell
curl -X POST "https://swuhcvokawzzttaambde.supabase.co/functions/v1/inkly-api/cards" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Idempotency-Key: YOUR_UNIQUE_EVENT_ID" \
  --data-binary @card.json

Message and address requirements

Keep the message within 500 characters and 16 lines. You can personalize it with {{first_name}}, {{last_name}}, and {{company}}; the finished message must also fit within 500 characters. A blank company becomes “your team.”

All recipient fields shown above are required. Use a two-letter US state code and a five-digit ZIP or ZIP+4. You can also include company and address2 inside recipient.

Schedule a card

Add an optional target_arrival field to the top level of your JSON using YYYY-MM-DD. Choose today or a date up to 365 days ahead. Inkly calculates a mail date five business days before that date. Close dates, or requests without a date, mail as soon as possible. The date schedules mailing; delivery timing depends on USPS.

Read the response

A new order returns 201 Created. A successful idempotent replay returns 200 OK. Both contain these fields:

FieldMeaning
orderIdThe order ID. Use it to find the card on your dashboard.
costCentsThe amount charged in cents. A replay returns 0.
balanceCentsYour remaining credit balance in cents.
replayedfalse for a new order; true when the original order is returned.
targetArrivalThe requested arrival date, or null when no date was set.
mailsOnThe scheduled mail date in YYYY-MM-DD format, or "asap".

Follow the order's progress on your dashboard.

4. Make retries safe

Send an X-Idempotency-Key header with every card request. Keep it stable for retries of the same event and use a new value for each new card. The value can be up to 255 characters.

When a valid request repeats the same idempotency key with the same API key, Inkly returns the original order with replayed: true and costCents: 0. It does not create or charge for a second card. Reusing a key does not update the original card. Without an idempotency key, a retry can create another order.

Handle errors

Error responses include an error message. Check both the HTTP status and that message before deciding what to retry.

StatusWhat to do
400The request body is not valid JSON. Check the contents of card.json.
401The API key is missing, invalid, or revoked. Check the Bearer header and your dashboard.
402Your balance cannot cover the card. Add credits, then retry with the same idempotency key.
404The route or HTTP method is incorrect. Check the base URL and endpoint.
422A field failed validation. Read the error text, correct the fields, then retry.
500The server could not complete the response. Retry shortly with the same API key and idempotency key.