How requests work
The same rules hold for every request.
Keys and access
Send your key with every request, in the Authorization header. A key works for your business only.
Each area has its own access. Read lets a key look (GET requests). Read and write lets it change things too. A key can't make or revoke keys, or make, publish or delete flipbooks and catalogs: do those in Reeflip.
A wrong or revoked key gets invalid_api_key. A key without the access needed gets api_key_permission_required.
GET /api/v1/products HTTP/1.1 Host: app.reeflip.com Authorization: Bearer fbk_9wXc2…
Errors
When something goes wrong, the status is 400 or above and the answer always has the same shape.
Check code in your program: it never changes. message is written for people, so you can show it. retryable tells you if the same request may work later.
Errors any request can get
invalid_request400Something you sent is wrong.
detailsnames the field.invalid_api_key401The key is wrong, or it was revoked.
api_key_permission_required403The key doesn't have the access this needs.
…_not_found404Nothing with that id in your business, such as
product_not_found.…_conflict409It changed after you read it, such as
product_conflict. Read it again, then make your change.rate_limited429Too many requests. Wait for
Retry-After.internal_error500Something broke on our side. Try again later.
service_unavailable503Reeflip is busy for a moment. Try again later.
Each endpoint lists the other errors it can give.
{
"error": {
"code": "product_not_found",
"message": "This product does not exist, or was deleted.",
"details": {},
"retryable": false
}
}Long lists
Lists come a page at a time. Send limit for the page size, 1 to 100 (50 if you leave it out).
While next_cursor isn't null, send it back as cursor to get the next page.
curl "https://app.reeflip.com/api/v1/products?limit=100&cursor=eyJpZCI6IjZmMWMyYTkwIn0" \ -H "Authorization: Bearer $REEFLIP_KEY"
Limits
Each key can send 200 requests a minute. Past that you get rate_limited with a Retry-After header: wait that many seconds, then send again.
Your other keys, and Reeflip itself, have limits of their own.
HTTP/1.1 429 Too Many Requests
Retry-After: 12
{
"error": {
"code": "rate_limited",
"message": "Too many requests. Try again shortly.",
"details": {},
"retryable": true
}
}Sending again safely
If a request times out, you can't tell whether it worked. To send it again without doing it twice, add an Idempotency-Key header to POST requests: any unique text, such as a UUID. Make it once, and send the same one with every try.
For 24 hours, the same key with the same request gets the first answer again, with Idempotent-Replayed: true. The same key with a different request gets idempotency_key_reused.
curl -X POST https://app.reeflip.com/api/v1/products \ -H "Authorization: Bearer $REEFLIP_KEY" \ -H "Idempotency-Key: 5f1c7b0e-3a1d-4c6e-9b1a-0f2d7e8c4a21" \ -H "Content-Type: application/json" \ -d '{ "title": "Oak dining chair" }'