Optifeed API
Quick start
Create an API user, get an access token and send your first order.
This guide takes you from a new API user to a first accepted order. You need a terminal with curl.
1. Create an API user
An API user is the identity that your system uses to sign in. Your company owns the API user, not a person. It has no expiry date.
- Sign in to the Optifeed web app.
- Open Account, then Optifeed API.
- Click New API user.
- In Name, type the name of the system that uses the API user, for example
ERP sync. - Click Create API user.
Only a user manager of your company can open the Optifeed API page. The New API user button shows only when your company is active.
The page then shows the Client id and the Client secret. Copy the client secret now, because Optifeed shows it only one time. If you lose the client secret, revoke the API user and create a new one.
Keep the two values in environment variables on your server:
export OPTIFEED_CLIENT_ID="your client id"
export OPTIFEED_CLIENT_SECRET="your client secret"
2. Get an access token
Send the client id and the client secret to the token endpoint. Use the client credentials grant.
curl https://api.optifeed.com/v1/oauth/token \
-d grant_type=client_credentials \
-d client_id="$OPTIFEED_CLIENT_ID" \
-d client_secret="$OPTIFEED_CLIENT_SECRET"
The answer is 200 OK:
{
"access_token": "ofo_EXAMPLE",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "read",
"created_at": 1796029200
}
The access token is valid for one hour. Use the same token for each request in that hour. Put the value of access_token in a variable:
export OPTIFEED_TOKEN="ofo_EXAMPLE"
3. Check the access token
Send the access token in the Authorization header to the health endpoint:
curl https://api.optifeed.com/v1/health \
-H "Authorization: Bearer $OPTIFEED_TOKEN"
The answer is 200 OK:
{
"status": "ok",
"request_id": "6f1c0e5a-2b7d-4c1e-9a43-0d8f2c1b7e55"
}
A 401 or a 403 answer has an error code. Errors gives the meaning of each code.
4. Send your first order
Send a JSON object with an orders list. This list has one small order:
curl https://api.optifeed.com/v1/orders \
-H "Authorization: Bearer $OPTIFEED_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"orders": [
{
"id": "A-1",
"created_at": "2026-11-20T14:05:00+03:00",
"updated_at": "2026-11-20T14:05:00+03:00",
"currency": "TRY",
"total": "199.90",
"customer": {
"email_sha256": "9b00b0b820caf9556ca074ae455f87d32be94b9543993df0b71176d755f720f7"
},
"line_items": [
{ "id": "A-1-L1", "sku": "SKU-1", "quantity": 1, "unit_price": "199.90" }
]
}
]
}'
The rules for this order:
id,created_at,updated_at,currency,total,customerandline_itemsare required.- Each line item needs a
skuand aquantity. - Send each amount as decimal text, for example
"199.90". A JSON number is an error. - Send each time in ISO 8601 with a time zone offset, for example
"2026-11-20T14:05:00+03:00". - Send the currency as an ISO 4217 code, for example
TRY. - The customer needs a key: an
id, or a SHA-256 hash of the email or the phone.
email_sha256 is the SHA-256 hash of the email in lowercase, with no spaces at the start or the end. Send it as 64 hexadecimal characters. Optifeed never gets the email itself. To make the hash in a terminal:
printf '%s' 'ayse@example.com' | shasum -a 256
A customer has four hash fields, one for each match rule of the ad platforms. Customers gives the rule and the channels of each hash.
5. Read the answer
The answer is 202 Accepted:
{
"accepted": 1,
"rejected": 0,
"stale": 0,
"errors": [],
"warnings": [],
"request_id": "6f1c0e5a-2b7d-4c1e-9a43-0d8f2c1b7e55"
}
202 means that Optifeed checked each order and stored each valid order, except a stale order. A stale order is older than the version that Optifeed has. Optifeed processes the stored orders after the answer.
A 202 answer can also have rejected and stale orders. Always read rejected, stale and errors. Errors explains each field and each code.
Test with a dry run
Add ?dry_run=true to a write request, for example POST /v1/orders?dry_run=true. Optifeed checks each record and answers as for a real request, with "dry_run": true in the answer. It stores nothing.
- Send
dry_runonly in the query string. Optifeed ignores adry_runkey in the JSON body. - Send only
trueorfalse. Another value gets400with the codeinvalid_dry_run, and Optifeed stores nothing. - A dry run counts in the rate limit.
Testing tells what a dry run checks and what it does not do.
Next steps
- Orders: each order field, the update of an order and the stale rule.
- Testing: the dry run and a checklist before you go live.
- Authentication: the lifetime of a token, the revoke of an API user and the refusals of a company.
- Limits: the size of a request and the rate limits.
- Errors: each error code.
