Skip to Content
AffFast

Postbacks

Get conversions in near real time from Awin, Impact, Tradedoubler and tracking platforms.

A postback is a request that a network sends when a conversion happens. You get the conversion in seconds. You do not wait for the next sync.

A postback is a hint. The sync of the connection is the source of truth. A postback makes a provisional conversion. The next sync of the same conversion overwrites it. You never get a duplicate.

How it works

  1. You make a postback source for a connection. The API gives you a secret URL.
  2. You paste the URL into the network. The network calls it for each conversion.
  3. The endpoint stores the request and answers 200 at once.
  4. A worker makes the provisional conversion. The API sends the conversion.created event to your webhooks.
  5. The next sync overwrites the provisional conversion with the data of the network.

The same transaction ID must be in the postback and in the sync. The API deduplicates on it.

A postback never changes a conversion that a sync wrote already. A postback for a known provisional conversion can change its status (for example Impact REVERSED).

Make a source

You need an API key with the scope connections:write. Only owners and admins have it.

curl -X POST https://api.afffast.com/v1/postback_sources \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "connection": "conn_...", "label": "Awin main" }'

The response has two URLs:

  • url is the secret URL. The token in it is a credential. Anyone who has it can send conversions. Do not share it.
  • template_url is url with the parameters and the macros of the network. Paste this URL into the network.

Use POST /v1/postback_sources/{id}/reveal to see the URL again. Use POST /v1/postback_sources/{id}/rotate to make a new token. The old URL stops at once.

A connection can have 5 sources.

Awin

  1. Make a source for an Awin connection. The template is awin.
  2. In Awin, open Toolbox, then Transaction Notifications. Awin support must turn the option on in some accounts.
  3. Choose the method GET. Paste template_url. Turn on Click Source Data.

The macros are !!!transactionId!!!, !!!transactionDate!!!, !!!transactionAmount!!!, !!!transactionCurrency!!!, !!!commission!!!, !!!merchantId!!!, !!!affiliateId!!! and !!!clickRef!!! to !!!clickRef6!!!.

Awin sends the amounts in the currency of the program. The sync brings the amounts in the currency of your account. The sync overwrites the provisional amounts. A POST callback also works: the endpoint reads the field AwinTransactionPush.

Impact

  1. Make a source for an Impact connection. The template is impact.
  2. In Impact, open Technical, then Event Notifications. Make a notification for the event "Action Tracked". Choose the method GET. Paste template_url.

The macros are {ActionId}, {CampaignId}, {Oid}, {Amount}, {Payout}, {Currency}, {EventDate}, {State} and {SubId1} to {SubId3} and {SharedId}.

Tradedoubler

  1. Make a source for a Tradedoubler connection. The template is tradedoubler.
  2. Make a Conversions push subscription in the Tradedoubler account. Use the method GET and paste template_url.

The placeholders are ${transactionId}, ${orderNumber}, ${orderValue}, ${publisherCommission}, ${currencyId}, ${programId}, ${siteId}, ${timeOfEvent}, ${messageTypeId}, ${epi} and ${epi2}. The message type gives the status: 1 Tracked, 4 Pending and 3 Paused are pending. 5 and 6 are approved. 2, 7 and 8 are rejected. 9 is paid.

Tracking platforms (custom)

Use the template custom for any other platform, for example Everflow or Tune. You tell the API which parameter holds which field.

{
  "connection": "conn_...",
  "mapping": {
    "external_id": "txn_id",
    "order_amount": "amount",
    "commission": "payout",
    "currency": "currency",
    "click_id": "sub1",
    "status": "status",
    "status_map": { "approved": "approved", "rejected": "rejected" },
    "sold_at": "ts"
  }
}

Only external_id is required. click_id is the parameter that holds our click ID. subids maps a SubID slot of the network to a parameter. time_format is auto, unix or unix_ms. Change the mapping with PATCH /v1/postback_sources/{id}.

Attribution

Our click ID goes in the first SubID slot of the network. A postback with a valid click ID gets the click context (site, page, referrer, country) like a synced conversion. A value that is not a click ID of ours is ignored.

Limits and errors

  • The endpoint accepts GET and POST. A query can have 8 KB. A body can have 64 KB.
  • The endpoint limits the requests for each IP address and for each token. It answers 429 with Retry-After.
  • An unknown, disabled or rotated token gets the same 200 answer as a good one. The endpoint stores nothing for it. This way nobody can find out which tokens exist.
  • A postback that has no usable transaction ID, or an amount that is not a number, makes no conversion. The raw request stays in the log for 90 days.

On this page