Optifeed API
Errors
The error shape, each error code, and the errors and warnings of each record in a 202 answer.
The API uses HTTP status codes and an error code in the body. Use the error code in your code. The message is for a person, and it can change.
The error shape
Each answer of the API has a request_id, except the answers of the token endpoint. An error answer has this shape:
{
"error": {
"code": "invalid_batch",
"message": "Send a JSON object with a list of 1 to 1,000 records.",
"retryable": false,
"param": "orders"
},
"request_id": "6f1c0e5a-2b7d-4c1e-9a43-0d8f2c1b7e55"
}
| Field | Value |
|---|---|
error.code |
The error code. The next table gives each code. |
error.message |
A text for a person. Do not parse it. |
error.retryable |
true when the same request can work later with no change. |
error.param |
The field or the query parameter that caused the error, or null. |
request_id |
The id of the request. The X-Request-Id header has the same value. |
Optifeed keeps a record of each request of an API user for 30 days. Give the request_id to Optifeed support, and support can find the request.
Error codes
| Code | Status | Meaning | retryable |
What to do |
|---|---|---|---|---|
unauthorized |
401 |
The access token is missing or not valid. | false |
Get an access token and send it as Authorization: Bearer <token>. |
token_expired |
401 |
The access token expired. | false |
Get a new access token, then send the request again. |
token_revoked |
401 |
The access token or its API user was revoked. | false |
Create a new API user. |
token_not_accepted |
403 |
The token is not the access token of an API user. | false |
Use the access token from POST /v1/oauth/token. |
company_inactive |
403 |
The company of the API user is not active. | false |
Contact Optifeed. |
company_pending_approval |
403 |
The company waits for approval. | false |
Wait for the approval. |
trial_ended |
403 |
The trial of the company ended. | false |
Choose a plan in the web app. |
ip_not_allowed |
403 |
The IP address of the request is not on the IP list of the API user. The message names the IP address. | false |
Add the IP address to the list on the Optifeed API page, or send from an IP address on the list. |
rate_limited |
429 |
Too many requests. | true |
Wait for the seconds in Retry-After, then send the request again. |
not_found |
404 |
The path does not exist, or a DELETE found no record with that sku or id. |
false |
Check the path. After a DELETE, the record is not in Optifeed. |
invalid_json |
400 |
The body is not valid JSON. | false |
Correct the body. |
invalid_batch |
400 |
The body has no list of 1 to 1,000 records. | false |
Send a JSON object with one list of records. |
batch_too_large |
400 |
The list has more than 1,000 records. | false |
Divide the batch. |
payload_too_large |
413 |
The body is larger than 5 MB. | false |
Divide the batch. |
invalid_dry_run |
400 |
The dry_run query parameter is not true or false. |
false |
Send dry_run=true or dry_run=false. |
catalog_inactive |
409 |
The catalog of the API products of the company is not active. | false |
Contact Optifeed support. |
order_log_busy |
503 |
Optifeed is busy with the orders of the company. | true |
Send the same batch again. |
Limits gives the limits behind rate_limited, batch_too_large and payload_too_large.
Errors and warnings of records
A write request gets 202 Accepted when its body is a valid batch. Optifeed then checks each record by itself. It stores each valid record and rejects each record with an error. So one answer can have accepted and rejected records.
{
"accepted": 1,
"rejected": 1,
"stale": 0,
"errors": [
{
"position": "orders[1]",
"id": "A-2",
"param": "total",
"code": "amount_not_text",
"message": "Send the amount as decimal text, for example \"199.90\", not as a JSON number."
}
],
"warnings": [
{
"position": "orders[0]",
"id": "A-1",
"param": "customer.gender",
"code": "invalid_value",
"message": "Send female or male. Optifeed dropped the value."
}
],
"request_id": "6f1c0e5a-2b7d-4c1e-9a43-0d8f2c1b7e55"
}
| Field | Value |
|---|---|
accepted |
The number of records that Optifeed stored. |
rejected |
The number of records with one or more errors. Optifeed did not store them. |
stale |
The number of valid records that Optifeed did not store, because it has a newer version. |
errors |
One item for each error. A record can have more than one error. |
warnings |
One item for each warning. |
dry_run |
true. Only the answer of a dry run has this field. |
request_id |
The id of the request. |
Each item of errors and warnings has these fields:
| Field | Value |
|---|---|
position |
The place of the record in the list, for example orders[1]. The first record is [0]. |
id or sku |
The id of the record: sku for a product, id for an order, a customer or a campaign. It is null when the record has no valid id. |
param |
The field of the issue, for example total, line_items[0].sku or customer.email_sha256. It is null when the issue is about the full record. |
code |
The code of the issue. The next tables give each code. |
message |
A text for a person. It never contains the value that you sent. |
Record error codes
An error rejects the record.
| Code | Meaning |
|---|---|
not_an_object |
The record is not a JSON object. |
required |
A required field is missing or null. |
invalid_type |
The value has the wrong type, for example a number in place of a list. |
too_long |
The value is too long. The message gives the limit. |
invalid_currency |
The currency is not an ISO 4217 code of 3 letters. |
amount_not_text |
An amount is a JSON number. Send it as decimal text, for example "199.90". |
invalid_amount |
An amount is not decimal text from 0 to 9999999999.99 with 2 decimals at most. |
invalid_date |
A time is not ISO 8601 with a time zone offset, for example "2026-11-20T14:05:00+03:00". |
future_date |
updated_at is more than 24 hours in the future. |
customer_key_missing |
The customer has no key. Send a valid email or phone hash, or an id. |
invalid_value |
The value is not one of the permitted values, for example an unknown availability of a product. |
invalid_key |
A key is not permitted, for example an unknown key in the targets or the conditions of a campaign. |
reserved_key |
A product attribute uses a key that Optifeed keeps for its own fields. |
duplicate_attribute |
A product sends the same key at the top level and in attributes. |
Record warning codes
A warning does not reject the record.
| Code | Meaning |
|---|---|
invalid_hash |
A contact hash is not a SHA-256 hex string of 64 characters. Optifeed dropped the value and kept the record. |
invalid_value |
The gender, the city or the country of a customer is not in a permitted format. Optifeed dropped the value and kept the record. |
content_gap |
A product or a campaign has no value for a field that a channel needs. Optifeed accepted the record without it. |
stale |
Optifeed has a newer version of the product, so it ignored this one. |
customer_deleted |
You deleted the customer of the order, and the order is not newer than the delete. Optifeed stored the order with no customer. |
The code invalid_value is an error for a product or a campaign, and a warning for a field of a customer.
Stale records
Optifeed keeps the newest version of each record. It compares the updated_at of the record with the stored version, and with the other versions in the same batch.
- A valid record with an older
updated_atis stale. Optifeed counts it instaleand does not store it. - A record with the same
updated_atis not stale. It replaces the stored version. - A stale product also gets the warning
stale. - Campaigns have one difference. When one batch has two campaigns with one
id, Optifeed stores the newest one and counts both as accepted.
A dry run does not compare with the stored records. So in a dry run, stale is always 0 and no record gets the warning stale.
Errors of the token endpoint
POST /v1/oauth/token uses the OAuth 2.0 error shape. Its answers have no request_id.
{
"error": "company_inactive",
"error_description": "The company of the API user is not active."
}
error |
Status | Meaning |
|---|---|---|
invalid_client |
401 |
The client id or the client secret is wrong, or the API user was revoked. |
unsupported_grant_type |
400 |
grant_type is not client_credentials. |
unauthorized_client |
400 |
The client is not an API user. |
company_inactive |
403 |
The company of the API user is not active. |
company_pending_approval |
403 |
The company waits for approval. |
trial_ended |
403 |
The trial of the company ended. |
ip_not_allowed |
403 |
The IP address is not on the IP list of the API user. |
rate_limited |
429 |
Too many sign-ins. Limits gives the two sign-in limits. |
