Appearance
Print & Mail API
Product overview: Passport photo print and mailing.
Send us a photo and a mailing address in any country. The photo can be a photoUuid from the Passport Photo API or your own finished image. We print the photo on 4×6 inch photo paper and mail it to your customer. You get the tracking number through the API or a webhook, and pass it on to your customer.
text
1. Create the photo with POST /v2/makeIdPhoto, or use your own image
2. POST /api/print/create-order → paid from your prepaid balance
3. We print and mail the photos → IN_PRODUCTION, then SHIPPED
4. Get the tracking number → webhook, or query-orderAccess
The Print & Mail API is available on every account with an API key. You can start right away: sandbox orders are free and never printed.
Real orders are paid from a prepaid print balance on your account. New accounts start with a balance of $0.00, so a real order returns 402 INSUFFICIENT_BALANCE until you add funds by contacting support@idphoto.ai. Check it with POST /api/print/query-balance, or see the balance and every transaction on the Print & Mail page of the Dashboard.
Before you start
You use the same API key and API secret as the Passport Photo API. Send requests from your server. Keep both credentials out of browser code, mobile applications, source control, and logs.
| Item | Value |
|---|---|
| Base URL | https://saas-api.idphotoapp.com |
| Test environment | A separate base URL and key, available on request from support@idphoto.ai. Test environment orders are never printed. Most integrations only need sandbox orders. |
| Method | POST for every endpoint, Content-Type: application/json |
| Authentication | apiKey and apiSecret in the JSON body |
| Times | ISO 8601 in UTC, for example 2026-11-17T15:20:00Z |
| Amounts | US dollars, as numbers with 2 decimal places |
| Request size | 8 MB at most, to allow a Base64 photo |
| Rate limit | 10 requests per second per key. 200 sandbox orders per day per account. |
| Destinations | Addresses in any country, including US APO/FPO addresses |
The production and test environments are fully separate. A key, balance, order, or webhook address from one does not work in the other.
Endpoints
| Endpoint | Use |
|---|---|
POST /api/print/create-order | Create a print order |
POST /api/print/query-order | Get one order by orderId or externalOrderId |
POST /api/print/query-order-paging | List your orders, page by page, filtered by creation time or status |
POST /api/print/cancel-order | Cancel an order before printing starts |
POST /api/print/query-balance | Get your print balance |
Create an order
http
POST /api/print/create-orderSend exactly one photo source: photoUuid or photoImage.
Request
| Field | Type | Required | Description |
|---|---|---|---|
apiKey | string | Yes | Your API key. |
apiSecret | string | Yes | Your API secret. |
idempotencyKey | string | Yes | Up to 64 characters, unique for each order you place. Sending the same key again returns the first order and does not charge twice. |
externalOrderId | string | No | Up to 64 characters. Your own order number. It is returned in every response and webhook. |
photoUuid | string | One photo source | The photoUuid returned by POST /v2/makeIdPhoto for this account, any specification. The print size is taken from the photo's spec code, so do not send printSize. |
photoImage | string | One photo source | Your own finished photo, Base64 without a data: prefix. JPEG or PNG, 5 MB at most. |
printSize | object | With photoImage | The printed size of one photo: width, height and unit (inch or mm). Example: {"width": 2, "height": 2, "unit": "inch"} or {"width": 35, "height": 45, "unit": "mm"}. Must match the image's aspect ratio within 2%. |
photoPairs | integer | No | Number of pairs of photos, 1 to 5. One pair is 2 photos. Defaults to 1. |
shippingMethod | string | Yes | STANDARD, TRACKED, or EXPRESS. See Shipping methods. STANDARD has no tracking number. |
recipient | object | Yes | Mailing address. See Recipient. |
notifyRecipient | boolean | No | Defaults to false. When true, we email the recipient a plain, unbranded shipping notice with the tracking number. Requires recipient.email. |
isSandbox | boolean | No | Defaults to false. true creates a test order that is never charged, printed, or mailed. See Sandbox orders. |
testScenario | string | No | Sandbox orders only. DELIVERED (default), FAILED, RETURNED, or UNTRACKED. |
Recipient
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Up to 40 characters. |
company | string | No | Company name. |
address1 | string | Yes | Street address. |
address2 | string | No | Apartment, suite, or unit. |
city | string | Yes | City. |
state | string | Depends on country | State, province, or region. Required for US addresses: a two-letter state code, or AA, AE, or AP for APO/FPO addresses. Send it for other countries when the address uses one. |
zip | string | Depends on country | Postal code. Required when the country uses postal codes. For US addresses: a 5-digit ZIP code or ZIP+4, for example 95112 or 95112-1234. |
country | string | Yes | Two-letter ISO 3166-1 country code, for example US, GB, CA, or AU. |
phone | string | No | Phone number. Recommended for addresses outside the US. |
email | string | No | Required when notifyRecipient is true. |
Example request
json
{
"apiKey": "your-api-key",
"apiSecret": "your-api-secret",
"idempotencyKey": "order-10023",
"externalOrderId": "10023",
"photoUuid": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d",
"photoPairs": 1,
"shippingMethod": "TRACKED",
"recipient": {
"name": "Jane Doe",
"address1": "123 Main St",
"address2": "Apt 4",
"city": "San Jose",
"state": "CA",
"zip": "95112",
"country": "US"
},
"notifyRecipient": false
}Response
json
{
"orderId": "po_01JD8X5Q7R2M3N4P5S6T7V8W9X",
"externalOrderId": "10023",
"isSandbox": false,
"status": "PENDING",
"photoSource": "PHOTO_UUID",
"photoPairs": 1,
"shippingMethod": "TRACKED",
"trackingAvailable": true,
"price": { "total": 10.00, "currency": "USD" },
"balanceAfter": 490.00,
"printSize": { "width": 2, "height": 2, "unit": "inch" },
"sheetCount": 1,
"createdAt": "2026-11-17T02:00:00Z"
}Amounts in the examples on this page are illustrative only.
| Field | Description |
|---|---|
orderId | Our order ID. Use it with every other endpoint. |
status | Always PENDING for a new order. See Order status. |
photoSource | PHOTO_UUID or UPLOADED. |
trackingAvailable | false for STANDARD, which has no tracking number. |
price.total | The amount charged for this order. A sandbox order shows the amount but is not charged. |
balanceAfter | Your print balance after this order. |
printSize | The printed size of each photo. |
sheetCount | Number of 4×6 inch sheets we will print. See Print sizes. |
If you send the same idempotencyKey again with the same fields, you get the first order back with HTTP 200 and "idempotentReplay": true. With different fields, you get 409 IDEMPOTENCY_CONFLICT.
What we check
An order that fails a check is not created and not charged.
| Check | Error |
|---|---|
| Key and secret are valid and the account is active | 403 AUTH_FAILED |
| Printing has not been turned off for the account | 403 PRINT_NOT_ENABLED |
Exactly one of photoUuid and photoImage is sent | 400 INVALID_PHOTO_INPUT |
The photoUuid exists, belongs to this account, and has a final (unwatermarked) photo | 404 PHOTO_NOT_FOUND |
photoImage is a readable JPEG or PNG of 5 MB or less | 400 INVALID_PHOTO_IMAGE |
printSize is sent with photoImage only, and matches the image's aspect ratio | 400 INVALID_PRINT_SIZE |
| The photo is at least 200 DPI at the printed size | 400 PHOTO_RESOLUTION_TOO_LOW |
| The photo fits on a 4×6 inch sheet | 400 PHOTO_SIZE_NOT_PRINTABLE |
| The address has the required fields for its country | 400 INVALID_ADDRESS |
| The balance covers the order (not checked for sandbox orders) | 402 INSUFFICIENT_BALANCE |
We check the photo's format, size, and resolution. We do not check whether the photo meets a government's photo rules. Check it first with Photo Compliance Check. US passport photos must not be digitally altered: see that page before you print one.
We check the address format, not whether the address can receive mail. If we find a problem before printing, the order becomes FAILED and the amount goes back to your balance.
Get an order
http
POST /api/print/query-order| Field | Type | Required | Description |
|---|---|---|---|
apiKey | string | Yes | Your API key. |
apiSecret | string | Yes | Your API secret. |
orderId | string | One of the two | Our order ID. |
externalOrderId | string | One of the two | Your order number. If several orders share it, the newest is returned. |
json
{
"orderId": "po_01JD8X5Q7R2M3N4P5S6T7V8W9X",
"externalOrderId": "10023",
"isSandbox": false,
"status": "SHIPPED",
"statusReason": null,
"photoSource": "PHOTO_UUID",
"photoPairs": 1,
"printSize": { "width": 2, "height": 2, "unit": "inch" },
"sheetCount": 1,
"shippingMethod": "TRACKED",
"trackingAvailable": true,
"price": { "total": 10.00, "currency": "USD" },
"refund": null,
"recipient": { "name": "Jane Doe", "city": "San Jose", "state": "CA", "zip": "95112", "country": "US" },
"trackingNumber": "LX123456789US",
"trackingUrl": "https://tracking.example.com/LX123456789US",
"createdAt": "2026-11-17T02:00:00Z",
"inProductionAt": "2026-11-17T18:05:00Z",
"shippedAt": "2026-11-17T23:20:00Z",
"deliveredAt": null,
"history": [
{ "status": "PENDING", "at": "2026-11-17T02:00:00Z" },
{ "status": "IN_PRODUCTION", "at": "2026-11-17T18:05:00Z" },
{ "status": "SHIPPED", "at": "2026-11-17T23:20:00Z" }
]
}| Field | Description |
|---|---|
statusReason | Why an order is FAILED, RETURNED, or CANCELED, for example ADDRESS_UNDELIVERABLE. Otherwise null. |
refund | null, or { "amount", "refundedAt" } after an amount goes back to your balance. |
recipient | Part of the address only, for privacy. |
trackingNumber, trackingUrl | Set when the order is SHIPPED. Always null for STANDARD. |
history | Every status change, oldest first. |
An unknown order, or an order of another account, returns 404 ORDER_NOT_FOUND.
List orders
http
POST /api/print/query-order-paging| Field | Type | Required | Description |
|---|---|---|---|
apiKey, apiSecret | string | Yes | Your credentials. |
status | string[] | No | Only these statuses, for example ["SHIPPED", "DELIVERED"]. |
createdFrom | string | No | Orders created at or after this time. |
createdTo | string | No | Orders created at or before this time. |
includeSandbox | boolean | No | Defaults to false. |
limit | integer | No | 1 to 100. Defaults to 50. |
cursor | string | No | The nextCursor from the previous page. |
json
{
"items": [
{ "orderId": "po_01JD8X5Q7R2M3N4P5S6T7V8W9X", "status": "SHIPPED", "...": "..." }
],
"nextCursor": "eyJjcmVhdGVkQXQiOi..."
}Each item has the same fields as Get an order, without history. nextCursor is null on the last page.
Cancel an order
http
POST /api/print/cancel-order| Field | Type | Required | Description |
|---|---|---|---|
apiKey, apiSecret | string | Yes | Your credentials. |
orderId | string | Yes | Our order ID. |
reason | string | No | Up to 200 characters. |
Only a PENDING order can be canceled. The full amount goes back to your balance.
json
{ "orderId": "po_01JD8X5Q7R2M3N4P5S6T7V8W9X", "status": "CANCELED", "refund": { "amount": 10.00, "refundedAt": "2026-11-17T03:10:00Z" }, "balanceAfter": 500.00 }Once printing starts, you get 409 ORDER_NOT_CANCELABLE. Canceling an order that is already canceled returns the same result again and does not refund twice.
Get your balance
http
POST /api/print/query-balancejson
{ "apiKey": "your-api-key", "apiSecret": "your-api-secret" }json
{ "balance": 490.00, "currency": "USD", "lowBalanceThreshold": 100.00 }When the balance falls below lowBalanceThreshold, we email you and send a PRINT_BALANCE_LOW webhook.
Add funds
Email support@idphoto.ai with the amount (minimum $1,000). We send you an invoice that you can pay by card or US bank account (ACH), or you can pay by wire transfer. We add the funds to your balance once the payment arrives, and the top-up appears in your transactions on the Dashboard.
Shipping methods
We mail to addresses in any country and choose the carrier and service for each order.
shippingMethod | Tracking number | Use |
|---|---|---|
STANDARD | No | Lowest cost |
TRACKED | Yes | Tracking number and link when the order ships |
EXPRESS | Yes | Faster delivery, with tracking |
Prices depend on the shipping method and are set for your account. Delivery time depends on the destination.
Order status
text
PENDING ──► IN_PRODUCTION ──► SHIPPED ──► DELIVERED
│ │ └──► RETURNED
└► CANCELED └► FAILED| Status | Meaning | Can cancel | Webhook |
|---|---|---|---|
PENDING | Charged, waiting to be printed | Yes, full refund | No. The create response already returns it. |
IN_PRODUCTION | Printing has started | No | Yes |
SHIPPED | Mailed. Has a tracking number, except STANDARD. | No | Yes |
DELIVERED | Delivered | — | Yes |
FAILED | Not mailed because of a photo or address problem. Refunded. | — | Yes |
RETURNED | Returned to us as undeliverable | — | Yes |
CANCELED | Canceled. Refunded. | — | Yes |
Sandbox orders
Set "isSandbox": true to test your integration in either environment. A sandbox order goes through the same checks as a real one, but it is never charged, printed, or mailed, and notifyRecipient is ignored.
A sandbox order moves to the next status about once a minute, so you receive the full set of webhooks within a few minutes. testScenario picks the path:
testScenario | Status path |
|---|---|
DELIVERED | PENDING → IN_PRODUCTION → SHIPPED → DELIVERED |
FAILED | PENDING → IN_PRODUCTION → FAILED, with statusReason: "ADDRESS_UNDELIVERABLE" |
RETURNED | PENDING → IN_PRODUCTION → SHIPPED → RETURNED |
UNTRACKED | Like DELIVERED, but SHIPPED has no tracking number, as with STANDARD |
Sandbox tracking numbers start with TEST, for example TEST0000000000000001, and trackingUrl is null. Webhooks carry "isSandbox": true. A sandbox order cannot be turned into a real order: create a new order with "isSandbox": false.
Webhooks
We send a POST to your webhook address each time an order changes status. Each account has one webhook address per environment. Set or change it on the Print & Mail page of the Dashboard, under Webhook. The address must use HTTPS. The same page has a Send test webhook button that sends a PRINT_WEBHOOK_TEST message and shows the HTTP status your server returned.
| Event | When | What you usually do |
|---|---|---|
PRINT_ORDER_IN_PRODUCTION | Printing started. The order can no longer be canceled. | Update the order status |
PRINT_ORDER_SHIPPED | Mailed | Send trackingNumber and trackingUrl to your customer |
PRINT_ORDER_DELIVERED | Delivered | Close the order |
PRINT_ORDER_FAILED | Photo or address problem. Refunded. | Ask your customer to fix it and order again |
PRINT_ORDER_RETURNED | Returned as undeliverable | Confirm the address with your customer |
PRINT_ORDER_CANCELED | Canceled. Refunded. | Update the order status |
PRINT_BALANCE_LOW | Balance fell below the threshold | Add funds |
PRINT_WEBHOOK_TEST | You clicked Send test webhook on the Dashboard | Check that your server receives and verifies it |
Example
http
POST https://api.example.com/hooks/idphoto
Content-Type: application/json
X-IDP-Timestamp: 1763421600
X-IDP-Signature: 5f2b9c...e1
User-Agent: IDPhoto-Webhook/1.0json
{
"eventId": "evt_01JD9A2B3C4D5E6F7G8H9J0K1M",
"event": "PRINT_ORDER_SHIPPED",
"occurredAt": "2026-11-17T23:20:00Z",
"attempt": 1,
"isSandbox": false,
"data": {
"orderId": "po_01JD8X5Q7R2M3N4P5S6T7V8W9X",
"externalOrderId": "10023",
"status": "SHIPPED",
"statusReason": null,
"shippingMethod": "TRACKED",
"trackingNumber": "LX123456789US",
"trackingUrl": "https://tracking.example.com/LX123456789US",
"shippedAt": "2026-11-17T23:20:00Z"
}
}data has the same fields as Get an order, without history. The example above is shortened. PRINT_BALANCE_LOW carries balance and lowBalanceThreshold instead of an order. PRINT_WEBHOOK_TEST has isSandbox: true and carries only a message. It is signed the same way as every other message.
Verify the signature
X-IDP-Signature is the lowercase hex HMAC-SHA256 of timestamp + "." + raw request body, keyed with your API secret. Reject a message when the signature does not match or the timestamp is more than 5 minutes from your clock.
js
import crypto from "node:crypto";
// rawBody must be the exact string received. Do not parse and re-serialize it.
function verify(rawBody, timestamp, signature, apiSecret) {
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;
const expected = crypto
.createHmac("sha256", apiSecret)
.update(`${timestamp}.${rawBody}`)
.digest("hex");
return expected.length === signature.length &&
crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(signature));
}python
import hashlib, hmac, time
def verify(raw_body: bytes, timestamp: str, signature: str, api_secret: str) -> bool:
if abs(time.time() - int(timestamp)) > 300:
return False
expected = hmac.new(api_secret.encode(), f"{timestamp}.".encode() + raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, signature)Delivery rules
- Return HTTP 2xx within 10 seconds, then process the message. If we do not get a 2xx, we retry up to 3 times: after 10 seconds, 30 seconds, and 60 seconds. Each retry has a new
attemptnumber and its own signature. - A message can arrive twice. Deduplicate by
eventId. - Messages can arrive out of order. Use the newer
occurredAt, or call Get an order for the current status. - If you miss a message, call Get an order or List orders. You can also poll these endpoints instead of using webhooks.
Print sizes
We print on 4×6 inch photo paper at 300 DPI, with at least a 0.25 inch white border. Photos are placed edge to edge, centered, at their exact printed size. The number of photos per sheet depends on the size:
| Photo size | Photos per sheet | Sheets for 1 pair | Sheets for 5 pairs |
|---|---|---|---|
| 2×2 in (US passport and visa) | 2 | 1 | 5 |
| 35×45 mm (Schengen, UK, and many others) | 6 | 1 | 2 |
| 33×48 mm (China visa) | 4 | 1 | 3 |
| 50×70 mm | 2 | 1 | 5 |
| 3×4 in | 1 | 2 | 10 |
Any passport, visa, or ID photo size is accepted. A large photo that fits only once on a sheet is printed one per sheet. A size larger than the printable area of a 4×6 inch sheet (about 3.5×5.5 inches) returns 400 PHOTO_SIZE_NOT_PRINTABLE. The price depends only on the number of pairs, not on the number of sheets.
Error codes
Errors use this format:
json
{
"statusCode": 402,
"errorCode": "INSUFFICIENT_BALANCE",
"message": "Your Print & Mail balance is $0.00, which is not enough for this order ($4.00). To add funds, contact support@idphoto.ai. Sandbox orders (isSandbox: true) are free."
}Use errorCode in your code. message is for people and can change. For a field validation error, message is a list of the fields that failed.
| HTTP | errorCode | Meaning |
|---|---|---|
| 400 | INVALID_PARAMS | A field is missing or has the wrong format |
| 400 | INVALID_PHOTO_INPUT | Neither or both of photoUuid and photoImage were sent |
| 400 | INVALID_PHOTO_IMAGE | The image cannot be read, is not JPEG or PNG, or is over 5 MB |
| 400 | INVALID_PRINT_SIZE | printSize is missing, not allowed, or does not match the image |
| 400 | PHOTO_RESOLUTION_TOO_LOW | Below 200 DPI at the printed size |
| 400 | PHOTO_SIZE_NOT_PRINTABLE | The photo is larger than a 4×6 inch sheet |
| 400 | INVALID_ADDRESS | A required address field is missing or has the wrong format for the country |
| 402 | INSUFFICIENT_BALANCE | The balance does not cover the order. New accounts start at $0.00. To add funds, contact support@idphoto.ai. |
| 403 | AUTH_FAILED | Wrong key or secret, an inactive account, or a key from the other environment |
| 403 | PRINT_NOT_ENABLED | Printing has been turned off for this account. Contact support@idphoto.ai. |
| 404 | PHOTO_NOT_FOUND | The photo does not exist or belongs to another account |
| 404 | ORDER_NOT_FOUND | The order does not exist or belongs to another account |
| 409 | IDEMPOTENCY_CONFLICT | The idempotencyKey was used with different fields |
| 409 | ORDER_NOT_CANCELABLE | Printing has started |
| 429 | RATE_LIMITED | Too many requests |
| 429 | SANDBOX_LIMIT_REACHED | Daily sandbox order limit reached |
| 500 | INTERNAL_ERROR | Our error. Retrying with the same idempotencyKey is safe. |
Support
To add funds, get a test environment, or ask about an order, contact support@idphoto.ai.
