Errors

Every error code of the API, what it means and what to do about it.

How the API reports an error

The API answers with HTTP 200 and JSON, also for an error. Read the code field. The value 200 means success. Any other value is an error.

AnswerShapeNotes
Success {"code":200,"data":...}The result is in data.
Most errors {"code":513,"data":"Invalid signature"}The text of the error is in data.
Errors of the read actions, for example get-banner-urls {"code":531,"message":"Banner not found"}The text is in message, not in data.
Most errors of the generation actions {"type":"error","code":"Banner not found","data":"531"}The code and the text are swapped. The number is in data.
Errors with a text code {"code":"INTERNAL_SERVER_ERROR","data":"Please fill in your identifier"}code is a word in capital letters, not a number.

This function returns the error code for every shape. For a text code, it returns the text.

function errorCode(answer) {
    if (typeof answer.code === 'number') {
        return answer.code;
    }
    if (/^\d+$/.test(String(answer.data))) {
        return Number(answer.data);
    }
    return answer.code;
}

Answers that are not JSON

If the server fails, the answer can be an HTML page, for example with HTTP 500 or 504. Treat an answer that is not JSON as a failure on the server side, and try again later.

Set a timeout on your requests, for example 30 seconds. A request that times out can still finish on the server. Look at the result before you send the request again, so that you do not start the same work twice.

Error codes

CodeMessageMeaningWhat to do
500 <the text of the failure>The sign-in step inside the API failed. The message has the details.Try again in a few minutes. If it keeps happening, contact Bannersnack support and send them the message.
510 The request has expiredThe time in t is more than one hour away from the clock of the API server. The API accepts a request from one hour before t until one hour after t. A missing t gives the same code.When you sign the request, set t to the current Unix time in seconds. Make sure that the clock of your server is correct. Sign the request again if it is older than one hour. Send every parameter in the query string, because the API does not read a POST body.
512 Client id not foundThe API does not know this client id.Make sure that client_id is the client id of your API credentials, with no extra spaces.
513 Invalid signatureThe signature does not match the parameters and your secret key.Sign with the secret key of your white label, not with the client id. Use every query parameter except signature. Sort the names in byte order. Join each name and its value with no separator. Compute the HMAC-SHA1 of the result as 40 lowercase hex characters. Sign the values before URL encoding.
514 Bad RequestYour white label does not allow this export type.Ask Bannersnack support to allow the export for your white label. MP4 and both GIF types need the MP4 and GIF export. PDF and print PDF need the PDF export. The ad tag types need the ad tag embed download. AMP needs no permission.
515 Disabled domainYour white label is not active.Contact Bannersnack support.
516 User disabledThe end user with this identifier is disabled.Enable the user again, or use another identifier.
517 Can't create more bannersThe end user reached the banner limit of your white label. The count has the published HTML5 banners that the user made since the last billing date.Wait for the next billing period, or ask Bannersnack support for a higher limit.
520 Missing mandatory parameter "<name>"A required parameter is missing. The message names it. A missing or unknown action also gives this code, with the name action.Add the parameter that the message names. If the message names network_id, Ad Network Id or Ad Network ID, send the id in ad_network. If it names Adtag type, send adtag_type.
521 Internal server errorThe API failed while it handled the request. A value of the wrong form also gives this code. Examples are an unknown export type, an unknown category_type, and data that is not a JSON array of name and value pairs.Make sure that every value matches this reference, then try again. If the values are right, try again in a few minutes.
530 Invalid format typebanner_type is not html5, jpg or png.Send html5, jpg or png.
531 Banner not foundThe API found no banner or banner set with this hash that the action can use. Each action has its own rules, for example that the banner is published or that it belongs to the identifier. The generation actions also use this code for most of their failures.Make sure that the hash is right. Make sure that it is a banner or a banner set, as the action needs. Read the rules of the action. For a generation action, give each layer on a slide of the source its own name.
532 Banner "<type>" not generatedThis export file of the banner does not exist yet.Wait until the export is ready, then try again.
533 File not foundThe API did not get the export file.Try again in a few minutes.
534 Identifier not foundThe owner of the banner is not a user of your white label.Make sure that the banner belongs to a user of your white label.
535 Invalid banner sizewidth or height is outside 10 to 3000.Send both width and height as whole numbers from 10 to 3000.
536 Invalid sizes parametersizes is not a comma-separated list of WIDTHxHEIGHT items, or a number in it is below 10.Send a list such as 300x250,728x90.
537 The following size(s) were not found : <sizes>One or more sizes are not in the size list of your white label. The message lists them.Use only sizes from the size list of your white label, or add the sizes to that list first.
539 Tags length must not exceed 255tags is longer than 255 characters.Send at most 255 characters in tags.
540 Invalid user name. <the characters that it can contain>The display name in name has a character that is not allowed. The API makes this test only when it creates the user.Use only letters, digits, spaces and @ # $ & . - _ / in name.
541 Invalid user identifier. <the characters that it can contain>The identifier has a character that is not allowed. The API makes this test only when it creates the user.Use only letters, digits, spaces and @ # $ & . - _ / in identifier.
547 Invalid template nametemplate_name is empty.Send a template name.
548 Category not foundcategory_id is missing, or no category with this id exists for the category type.With category_type custom, send the id of a custom category of your white label. Otherwise, send the id of a global template category.
553 Invalid Ad Network IDNo ad network has the id in ad_network.Get the ids with get-adtag-networks.
554 This Ad Network doesn't support iframeThis ad network does not take iframe ad tags.Leave out useiFrame, or choose another ad network.

A part of a message in angle brackets, such as <name>, changes from call to call.

Text codes

Some errors come with a word in code instead of a number. The text of the error is in data or message.

CodeMeaningWhat to do
INTERNAL_SERVER_ERROR The API failed and sent no error number. The message says why. For example, Please fill in your identifier means that identifier is empty.Fix the value that the message names, then try again. If the message names no value, try again in a few minutes.
UNAUTHENTICATED The sign-in step inside the API failed.Try again. If it keeps happening, contact Bannersnack support.
FORBIDDEN The API refused the request.Make sure that the hash and the identifier belong to your white label. If they do, contact Bannersnack support.
BAD_USER_INPUT A value has the wrong form.Make sure that every value matches this reference, then try again.

For another text code, read the text of the error. Make sure that every value matches the reference, then try again.

Codes that the API does not send

Older docs list 511 for maintenance. The API never sends 511. During maintenance, it answers with a redirect to a maintenance page. The API also never sends 518.