Skip to content

Response mapping

The response object on a leg tells Pingdex how to read the buyer’s reply. Quote legs and commit legs use different shapes.

Response mappings read JSON object bodies only. Pingdex does not read other formats.

Several keys take a path into the response body. A path is a list of keys separated by dots, for example data.transaction_id.

  • Every segment must be non-empty.
  • A numeric segment indexes into a JSON array, but only where the current value really is an array. For example offers.0.price reads the price key of the first item in offers.
  • A path that does not exist in the response counts as missing.

A quote leg must have a response.

Key Required Description
accepted Yes Path to the value that says whether the buyer accepted the ping.
bid Yes Path to the bid amount.
extract No Names for values to pass to a later leg.
accepted_values Only with rejected_values Values that mean the buyer accepted.
rejected_values Only with accepted_values Values that mean the buyer rejected.

No other keys are allowed.

{
"response": {
"accepted": "accepted",
"bid": "bid",
"extract": { "transaction_id": "data.transaction_id" }
}
}

Default. When you give no accepted_values or rejected_values, the value at accepted must be a JSON boolean:

  • true means accepted.
  • false means the quote is rejected (quote_rejected).
  • Anything else, including the string "true" or the number 1, is an invalid quote (invalid_quote_response).

Paired lists. If the buyer does not return booleans, give both accepted_values and rejected_values:

{
"response": {
"accepted": "status",
"accepted_values": ["Accepted", "Interested"],
"rejected_values": ["Declined"],
"bid": "price"
}
}
  • A value in accepted_values means accepted.
  • A value in rejected_values means the quote is rejected (quote_rejected).
  • A value in neither list is an invalid quote (invalid_quote_response).
  • You must provide both lists or neither. Providing only one is an error.

See value matching for the exact comparison rules.

Pingdex reads the bid at the bid path and accepts it only if it is a valid money amount:

  • A number or a numeric string. Other types are invalid.
  • Zero or greater. Negative values are invalid.
  • At most two decimal places, for example 12.5 or "12.50". A value such as 12.505 is invalid.
  • At most 9,999,999,999.99.
  • A numeric string must be plain decimal digits, with no exponent (1e3 is invalid) and no leading zeros ("007" is invalid).

A bid that is missing or fails these rules makes the quote invalid (invalid_quote_response), and the provider cannot win. Valid bids are compared as exact amounts to two decimal places.

extract maps a name to a path. A later leg can then use the value through a response field mapping. See Request mapping.

{ "extract": { "transaction_id": "data.transaction_id" } }
  • Names cannot be empty and cannot contain a dot or a line break.
  • Two names cannot point at the same path.
  • Extracted values must be a non-empty string, number or boolean.
  • Extracted values are sensitive. Pingdex does not store them in attempts, logs or browser responses.

If a later leg uses an extracted value and the buyer does not return it, the quote is rejected with missing_response_value.

On a commit leg, the response is optional. Without it, Pingdex records only whether the post was delivered.

When you do add one, these keys are required:

Key Required Description
accepted Yes Path to the value that says whether the buyer accepted the lead.
accepted_values Yes Non-empty list of values that mean accepted.
rejected_values Yes Non-empty list of values that mean rejected.
transaction_id No Path to the buyer’s reference for the lead.
sale_amount No Path to the actual sale amount.
rejection_reason No Path to a reason when the buyer rejects.

No other keys are allowed. Unlike a quote, a commit response has no boolean default, so both lists are always needed.

{
"response": {
"accepted": "status",
"accepted_values": ["Accepted", true, 1],
"rejected_values": ["Rejected", false, 0],
"transaction_id": "data.id",
"sale_amount": "data.amount",
"rejection_reason": "data.reason"
}
}

Pingdex reads the commit response only when the buyer returned a successful HTTP status. It then sets a commercial status:

Status Meaning
accepted The value at accepted matched accepted_values.
rejected The value at accepted matched rejected_values.
unknown Acceptance could not be established. The body is not a JSON object, the accepted path is missing, or the value is in neither list.

If the leg has no commit response, or the commit did not get a successful HTTP response, the commercial status is empty.

These are recorded when present and valid. A value that is missing or invalid is dropped, and does not change the commercial status.

Key Accepted values
transaction_id A string or whole number, up to 255 characters, with no control characters.
sale_amount A number or numeric string that follows the same rules as a bid. It is stored to two decimal places.
rejection_reason A non-empty string, up to 500 characters, with no control characters.

Pingdex stores these bounded values only. It never stores the raw buyer response. The sale amount is never copied from the bid, so revenue figures use the real sale amount, not the quote.

Both quote and commit lists use the same exact comparison:

  • Strings must match exactly, including case. "Accepted" does not match "accepted".
  • Booleans match booleans only.
  • Numbers match numbers numerically, so 1 and 1.0 are the same.
  • Different types never match. "1", 1 and true are three different values.

List rules, for every list:

  • It must be a non-empty list.
  • Entries must be a string, number or boolean.
  • A string entry must be 1 to 255 characters and cannot contain a line break or null character.
  • The same value cannot appear in both accepted_values and rejected_values.

Pingdex never sends the lead to another provider after a commercial rejection or an unknown outcome. See Lifecycle and statuses and Reporting.

These appear on attempts.

Code Leg Meaning
http_unsuccessful Quote The ping returned a non-successful HTTP status.
connection_failed Quote or commit No HTTP response was received (timeout or connection failure).
invalid_quote_response Quote The body was not a JSON object, accepted did not follow the rules above, or the bid was missing or invalid.
quote_rejected Quote The buyer declined the ping.
missing_response_value Quote A required extracted value was missing or unusable.
response_too_large Quote or commit The response exceeded the size limit.