Integration object
The integration object is the integration field of a provider. It tells Pingdex which HTTP requests to send to a buyer, how to build each request body from a lead, and how to read the buyer’s answer. Pingdex compiles it every time a provider is created or updated, and refuses anything that does not pass.
This page mirrors the compiler. If a rule is listed here, a request that breaks it returns 422 and nothing is saved. For the friendlier walkthrough, see Integration specification, Request mapping and Response mapping.
{ "legs": [ /* one or two leg objects */ ]}| Key | Type | Required | Description |
|---|---|---|---|
legs |
array | Yes | The ordered request legs. |
legs is the only key allowed. Any other key is refused with the reason unknown key. The object must be a JSON object and must not be empty.
Legal leg sequences
Section titled “Legal leg sequences”There are exactly two valid shapes:
| Shape | Legs | Suits campaign strategy |
|---|---|---|
| Commit only | One commit leg. |
priority |
| Quote then commit | One quote leg, then one commit leg. |
highest_bid |
Rules:
legsmust be a non-empty list.- Exactly one leg has the role
commit, and it must be last. - At most one leg has the role
quote. - If there is a quote leg, there must be exactly two legs. If there is none, there must be exactly one.
- Leg names must be unique.
Leg object
Section titled “Leg object”{ "name": "ping", "role": "quote", "request": { /* request object */ }, "response": { /* response mapping */ }}| Key | Type | Required | Description |
|---|---|---|---|
name |
string | Yes | The leg’s stable identifier. |
role |
string | Yes | quote or commit. |
request |
object | Yes | The request object. |
response |
object | Quote legs: yes. Commit legs: no. | A quote response mapping on a quote leg, or an optional commit response mapping on a commit leg. |
Only these four keys are allowed. Any other key is refused with unknown key.
Leg names
Section titled “Leg names”A leg name:
- is a string of at most 64 characters,
- starts with a letter or underscore,
- then contains only letters, digits, underscores or hyphens (the pattern is
^[A-Za-z_][A-Za-z0-9_-]*$).
Names such as ping, post, quote_1 and post-v2 are valid. 1post and ping now are not. A name identifies the leg in stored headers, in response field mappings and in lead attempts. Once saved, it cannot be renamed. See Providers.
| Role | Purpose |
|---|---|
quote |
The ping. Asks the buyer whether it wants the lead and for how much. It requires a response mapping. |
commit |
The post. Delivers the lead. Its response mapping is optional and reads commercial acceptance. |
Request object
Section titled “Request object”{ "method": "POST", "url": "https://buyer.example/post", "encoding": "json", "fields": { "Email": { "type": "field", "source": "payload.email" } }}| Key | Type | Required | Description |
|---|---|---|---|
method |
string | Yes | Must be POST. The check is case-insensitive. No other method is supported. |
url |
string | Yes | An absolute http or https URL of at most 2048 characters. |
fields |
object | Yes | A non-empty object of destination path to field mapping. |
encoding |
string | No | json (the default) or form. |
Only these four keys are allowed. Any other key is refused with unknown key.
The compiler accepts a URL that is a valid absolute URL with the scheme http or https. Any other scheme is refused with scheme must be http or https.
At delivery time Pingdex applies stricter checks. In production, only https is used, the host must resolve to public addresses only, and redirects are not followed. See Providers.
Encoding
Section titled “Encoding”| Value | Body sent | Content type |
|---|---|---|
json |
A JSON object. Destinations may be nested paths. Static values keep their JSON type. | application/json |
form |
URL-encoded fields. Destinations must be flat. Static values must be strings. | application/x-www-form-urlencoded |
Pingdex sets the content type. You cannot set it as a header.
Destination paths
Section titled “Destination paths”Each key in fields is a destination path in the request body.
- It must not be empty.
- It is split on
.. Each segment must be non-empty and must not consist only of digits. You cannot build arrays, soitems.0.idis refused. - With
formencoding, a destination cannot contain.. - One destination cannot be a parent of another.
customertogether withcustomer.emailis refused withconflicting destination paths.customer.emailtogether withcustomer.nameis fine. - Failures use the reason
destination path not allowed,nested destination not allowed for form encodingorconflicting destination paths.
For a JSON body, customer.email produces { "customer": { "email": "..." } }. After mapping, any object left empty because every field inside it was optional and missing is dropped from the body.
Field mappings
Section titled “Field mappings”A field mapping says where one value in the request body comes from. It is an object with a type, plus the keys that type needs.
type |
Source of the value | Required keys | Optional keys |
|---|---|---|---|
field |
The lead. | source |
optional, transform |
static |
A constant. | value |
optional, transform |
secret |
A stored provider secret. | secret |
optional, transform |
response |
A value extracted from an earlier leg’s response. | leg, source |
optional, transform |
Any key outside the lists for its type is refused with unknown key. A missing type, or a type that is not one of the four, is refused with type required or type not allowed.
{ "type": "field", "source": "payload.email" }source must be one of:
| Source | Value |
|---|---|
lead.id |
The lead’s identifier. |
lead.external_id |
The external_id you submitted. Missing if none was sent. |
payload.<path> |
A value from the lead payload. |
For payload.<path>, the path has one or more segments separated by .. Each segment must be non-empty and must not consist only of digits, so you can read nested object keys such as payload.address.postcode but not array items. Anything else is refused with path not allowed.
At delivery time the value must exist and be a string, number or boolean. A missing key, a null or an object or array resolves as missing.
static
Section titled “static”{ "type": "static", "value": "pingdex" }value must be a string, integer, finite number or boolean. With form encoding it must be a string. Failures use required, not a scalar or form encoding requires string values.
A static value is returned in full by the API, so never put a credential in one.
secret
Section titled “secret”{ "type": "secret", "secret": "api_token" }secret is the name of a secret stored on the provider. The mapping holds only the name. The name must be a non-empty string and must not contain ., carriage return or line feed (name not allowed). The value comes from the provider’s secrets at delivery time. If no secret with that name is stored, the attempt is recorded as not_sent with missing_mapped_field.
response
Section titled “response”{ "type": "response", "leg": "ping", "source": "transaction_id" }Copies a named value extracted from an earlier leg’s response, normally to send a buyer’s ping identifier back with the post.
legmust name an earlier leg (must reference an earlier leg).- That leg must be a quote leg with a response mapping (
leg has no extractable response). sourcemust be a key in that leg’sresponse.extract(unknown extract name).
Because it needs an earlier leg, a response mapping can appear only on the commit leg of a quote-then-commit integration.
Modifiers
Section titled “Modifiers”| Key | Type | Description |
|---|---|---|
optional |
boolean | Defaults to false. When true, a value that cannot be resolved is left out of the body instead of failing the attempt. It applies to missing values only. |
transform |
string | One of trim, lower, upper, digits. Applied after the value is resolved. |
Transforms apply to string values only. Other types pass through unchanged.
| Transform | Effect |
|---|---|
trim |
Removes whitespace from both ends. |
lower |
Converts to lower case. |
upper |
Converts to upper case. |
digits |
Keeps only the digits 0 to 9. |
A non-boolean optional is refused with must be a boolean. A non-string transform is refused with must be a string, and an unlisted one with transform not allowed.
Response mappings
Section titled “Response mappings”A response mapping tells Pingdex how to read a buyer’s JSON reply.
All response paths are dot paths into the JSON object the buyer returns. Each segment must be non-empty. A numeric segment indexes into a JSON array at that position, so offers.0.price reads the first offer’s price. A response that is not a JSON object is treated as unusable.
Quote response mapping
Section titled “Quote response mapping”Required on a quote leg.
{ "accepted": "accepted", "bid": "bid", "extract": { "transaction_id": "data.transaction_id" }, "accepted_values": ["yes"], "rejected_values": ["no"]}| Key | Type | Required | Description |
|---|---|---|---|
accepted |
string | Yes | Path to the value that says whether the buyer wants the lead. |
bid |
string | Yes | Path to the bid amount. |
extract |
object | No | Name to path map of values to carry to a later leg. |
accepted_values |
array | With rejected_values |
Values that mean the buyer accepted. |
rejected_values |
array | With accepted_values |
Values that mean the buyer declined. |
Only these five keys are allowed.
Acceptance. Without accepted_values and rejected_values, the value at accepted must be a JSON boolean: true accepts and false declines, and anything else is an invalid quote response. With the two lists, a value that matches accepted_values accepts, a value that matches rejected_values declines, and any other value is an invalid quote response. If you give one list, you must give the other.
Bid. The value at bid must be a non-negative amount of at most 9999999999.99 with no more than two decimal places. It can be a JSON number or a numeric string. Strings in exponent form, such as 1e3, are refused. A missing or invalid bid makes the quote invalid.
Extract. Each name in extract must be non-empty and must not contain ., carriage return or line feed. Each path must be a valid response path. Two names cannot share a path (duplicate path). Only names that a later response field mapping uses are read. A used extract must exist in the reply, be a string, number or boolean, and not be blank, otherwise the quote is refused with missing_response_value. Extracted values are treated as sensitive and are not stored in attempts or logs.
Commit response mapping
Section titled “Commit response mapping”Optional on a commit leg. Without one, a successful HTTP status counts as delivered and Pingdex records no commercial outcome. With one, Pingdex reads whether the buyer accepted the lead from the reply.
{ "accepted": "status", "accepted_values": ["Accepted", true, 1], "rejected_values": ["Rejected", false, 0], "transaction_id": "data.id", "sale_amount": "data.amount", "rejection_reason": "data.reason"}| Key | Type | Required | Description |
|---|---|---|---|
accepted |
string | Yes | Path to the value that says whether the buyer accepted the lead. |
accepted_values |
array | Yes | Values that mean accepted. |
rejected_values |
array | Yes | Values that mean rejected. |
transaction_id |
string | No | Path to the buyer’s transaction identifier. |
sale_amount |
string | No | Path to the amount the buyer paid. |
rejection_reason |
string | No | Path to a reason for rejection. |
Only these six keys are allowed.
HTTP success is not commercial acceptance. After a successful HTTP status, the value at accepted is compared with the two lists. A match with accepted_values records commercial_status as accepted. A match with rejected_values records rejected. Anything else, including a missing path or a reply that is not a JSON object, records unknown.
The values at transaction_id, sale_amount and rejection_reason are read when present. They are stored only if they fit the stored value limits, and they are treated as sensitive. The API returns sale_amount on a lead and its attempts, but never the transaction identifier or the rejection reason.
Outcome value lists
Section titled “Outcome value lists”accepted_values and rejected_values share these rules:
- Each must be a non-empty list.
- Each entry must be a string, integer, finite number or boolean.
- A string entry must be 1 to 255 characters and must not contain NUL, carriage return or line feed.
- No value may appear in both lists (
overlaps accepted_values).
Comparison is exact and type-aware:
| Comparison | Result |
|---|---|
"1" and 1 |
Different. A string never equals a number. |
1 and true |
Different. A boolean never equals a number. |
1 and 1.0 |
The same number. |
"Accepted" and "accepted" |
Different. Strings are case-sensitive. |
Headers and secrets
Section titled “Headers and secrets”Headers and secrets are not part of the integration object. They are sent beside it as headers and secrets. The compiler checks them in the same pass, so they have their own compile errors. The semantics for sending and clearing them are in Providers.
| Check | Reason |
|---|---|
headers must be an object keyed by leg name |
must be an object, leg name must be a non-empty string |
Each leg key must exist in integration |
unknown leg |
| Each leg’s value must be a non-empty object | must be an object, empty |
| Header names must be valid HTTP tokens | header name not allowed, header name must be a non-empty string |
| Header values must be strings without CR, LF or NUL | header value must be a string, header not allowed |
Accept, Connection, Content-Length, Content-Type, Host, Transfer-Encoding are refused |
header not allowed |
secrets must be an object of name to non-empty string |
must be an object, secret name must be a non-empty string, secret value must be a non-empty string |
Compile errors
Section titled “Compile errors”Compile errors have the form path: reason. The first problem found is returned. The error key is integration for integration paths, headers for paths beginning configuration.headers, and secrets for paths beginning configuration.secrets.
{ "message": "legs.1.request.fields.TransactionId.leg: must reference an earlier leg", "errors": { "integration": [ "legs.1.request.fields.TransactionId.leg: must reference an earlier leg" ] }}Paths use dot notation with zero-based list indexes. legs.0.request.fields is the fields object of the first leg. legs.1.response.accepted_values.2 is the third accepted value of the second leg.
Integration and leg
Section titled “Integration and leg”| Path | Reason |
|---|---|
integration |
missing, must be an object |
<key> (a top-level key other than legs) |
unknown key |
legs |
missing, must be a list, empty |
legs |
commit leg must be last |
legs |
exactly one commit leg is required |
legs |
at most one quote leg is permitted |
legs |
quote integrations must be quote then commit |
legs |
commit-only integrations must contain one leg |
legs.N |
must be an object |
legs.N.<key> |
unknown key |
legs.N.name |
missing, name not allowed, too long, duplicate |
legs.N.role |
missing, must be a string, unsupported role |
legs.N.request |
missing |
legs.N.response |
missing (quote legs), must be an object |
Request
Section titled “Request”| Path | Reason |
|---|---|
legs.N.request |
must be an object |
legs.N.request.<key> |
unknown key |
legs.N.request.method |
missing, must be POST |
legs.N.request.url |
missing, must be a url, scheme must be http or https |
legs.N.request.encoding |
must be a string, encoding not allowed |
legs.N.request.fields |
missing, must be an object, empty |
legs.N.request.fields |
destination path not allowed, nested destination not allowed for form encoding, conflicting destination paths, destination must be a string |
Field mappings
Section titled “Field mappings”| Path | Reason |
|---|---|
legs.N.request.fields.<destination> |
must be an object, type required |
legs.N.request.fields.<destination>.type |
type not allowed |
legs.N.request.fields.<destination>.<key> |
unknown key |
….source |
required, must be a non-empty string, path not allowed (type field), name not allowed (type response), unknown extract name |
….value |
required, not a scalar, form encoding requires string values |
….secret |
required, must be a non-empty string, name not allowed |
….leg |
required, must be a non-empty string, must reference an earlier leg, leg has no extractable response |
….optional |
must be a boolean |
….transform |
must be a string, transform not allowed |
Response mappings
Section titled “Response mappings”| Path | Reason |
|---|---|
legs.N.response |
must be an object |
legs.N.response.<key> |
unknown key |
legs.N.response.accepted |
missing, must be a path |
legs.N.response.bid |
missing, must be a path (quote legs) |
legs.N.response.accepted_values, legs.N.response.rejected_values |
missing (when only one is given, or on a commit leg), must be a list, empty |
legs.N.response.accepted_values.I, legs.N.response.rejected_values.I |
not a scalar, string not allowed |
legs.N.response.rejected_values |
overlaps accepted_values |
legs.N.response.extract |
must be an object, name not allowed |
legs.N.response.extract.<name> |
must be a path, duplicate path |
legs.N.response.transaction_id, sale_amount, rejection_reason |
must be a path |
Complete examples
Section titled “Complete examples”Commit only, JSON
Section titled “Commit only, JSON”Suits a priority campaign.
{ "legs": [ { "name": "post", "role": "commit", "request": { "method": "POST", "url": "https://buyer.example/post", "fields": { "Email": { "type": "field", "source": "payload.email", "transform": "lower" }, "Phone": { "type": "field", "source": "payload.phone", "transform": "digits", "optional": true }, "customer.postcode": { "type": "field", "source": "payload.postcode", "transform": "upper" }, "Reference": { "type": "field", "source": "lead.id" }, "Source": { "type": "static", "value": "pingdex" }, "ApiKey": { "type": "secret", "secret": "api_token" } } }, "response": { "accepted": "status", "accepted_values": ["Accepted"], "rejected_values": ["Rejected"], "transaction_id": "data.id", "rejection_reason": "data.reason" } } ]}Commit only, form encoded
Section titled “Commit only, form encoded”{ "legs": [ { "name": "post", "role": "commit", "request": { "method": "POST", "url": "https://buyer.example/form-post", "encoding": "form", "fields": { "email": { "type": "field", "source": "payload.email" }, "campaign": { "type": "static", "value": "remortgage" }, "key": { "type": "secret", "secret": "api_token" } } } } ]}Quote then commit
Section titled “Quote then commit”Suits a highest_bid campaign.
{ "legs": [ { "name": "ping", "role": "quote", "request": { "method": "POST", "url": "https://buyer.example/ping", "fields": { "LeadId": { "type": "field", "source": "lead.id" }, "Postcode": { "type": "field", "source": "payload.postcode" } } }, "response": { "accepted": "status", "accepted_values": ["bid"], "rejected_values": ["no_bid"], "bid": "offer.price", "extract": { "transaction_id": "offer.id" } } }, { "name": "post", "role": "commit", "request": { "method": "POST", "url": "https://buyer.example/post", "fields": { "OfferId": { "type": "response", "leg": "ping", "source": "transaction_id" }, "Email": { "type": "field", "source": "payload.email" } } }, "response": { "accepted": "result.accepted", "accepted_values": [true], "rejected_values": [false], "sale_amount": "result.amount" } } ]}