Data suppliers
API keys for data suppliers
Your key posts records to one campaign. It is shown once, sent in a header, and can be limited to your servers' addresses.
- Every post must carry your API key. A post to your campaign without a key is refused (HTTP 401
AUTH_REQUIRED), and so is one with a key that is not a supplier key, such as an affiliate key (HTTP 403FORBIDDEN,supplier_key_required). A key ICON does not know, another supplier's key and your key for another campaign each get their own refusal, listed under Answers. - Create the key on your campaign's page in ICON. It starts with
icsk_and is shown once, when you create it: store it then. ICON can't show it again, to you or to anyone. - A key works for its own campaign only. It posts records and runs the "Check before you post" check; it cannot search, read results or call ICON's other APIs.
- Send the key in a header only:
X-API-Key: <key>, orAuthorization: Bearer <key>. A request that carries it only in the URL or the body is refused. If you ever sent it that way, revoke it and create a new one, because it may now be in someone's logs. - Optional: when you create a key, list the IP addresses or ranges your servers post from (up to 20). A post from any other address is refused. Leave the list empty to allow any address.
- A campaign can have up to 5 live keys. To replace a key, create the new one, move your traffic to it, then revoke the old one: both work in between.
The check before you post is described on Post a record.
#Sending the key
http
POST /api/v1/engine/leads HTTP/1.1
X-API-Key: <your API key>
Content-Type: application/jsonOr Authorization: Bearer <your API key>. Keep the key on your servers: never put it in a web page or an app.
#When the key is refused
| code | HTTP | status | Send again? | When |
|---|---|---|---|---|
AUTH_REQUIRED | 401 | invalid | no | The post carried no API key. Every post to your campaign needs its key. reason: "missing_api_key": No key was sent. |
AUTH_INVALID | 401 | invalid | no | The key is unknown or revoked, or it was sent somewhere other than a header. reason: "invalid_api_key": ICON does not know this key, or it was revoked. reason: "supplier_key_header_only": The key was in the URL. Revoke it and create a new one. error: "supplier_key_header_only": The key was in the body. Revoke it and create a new one. |
FORBIDDEN | 403 | invalid | no | The key may not make this post. reason: "supplier_key_required": The post to your campaign carried a key that is not your campaign's supplier key (an affiliate key, say). reason: "ip_not_allowed_for_key": The post came from an address outside the key's IP allowlist. reason: "supplier_key_new_records_only": The post named a record ICON already has. Send new records only. reason: "campaign_outside_scope": The post named, by icon_campaign_id, a campaign that is not yours. reason: "offer_outside_scope": The post named, by icon_offer_id, an offer that is not yours. error: "Campaign or offer is outside supplier scope": The post named, by campaign code, a campaign that is not yours. reason: "campaign_not_allowed_for_key": The post named, by icon_campaign_id, another of your campaigns. A key posts to its own campaign only. reason: "supplier_key_campaign_invalid": The post named, by campaign code, another of your campaigns. A key posts to its own campaign only. error: "campaign_outside_affiliate": The campaign named is not your account's (when ICON checks that every post names its campaign and account). error: "affiliate_mismatch": icon_affiliate_id is not your key's account (when ICON checks that every post names its campaign and account). |
RATE_LIMITED | 429 | failed | yes, later | The key is over its limit. Wait the seconds in the Retry-After header, then send it again. |
Send the same request again only after RATE_LIMITED, once its wait is over. After AUTH_REQUIRED, AUTH_INVALID or FORBIDDEN, fix the key, the address or the request first.