Skip to content

Providers API

A provider is a buyer that receives your leads. It carries an integration object that describes the requests Pingdex makes, plus stored headers and secrets that authenticate those requests. Base URL: https://api.pingdex.io/api/v1. Every endpoint on this page needs the providers:manage scope.

Method Path Purpose
GET /providers List providers.
POST /providers Create a provider.
GET /providers/{provider} Show a provider.
PUT /providers/{provider} Replace a provider.
PATCH /providers/{provider} Replace a provider. PATCH behaves exactly like PUT.

For background, see Providers, Create a provider and Authentication for providers.

All examples assume:

Terminal window
export PINGDEX_API_KEY="pdx_example_0123456789abcdef"

Every endpoint on this page returns this object, or an array of it. It is the safe view of a provider.

Field Type Description
id string (UUID) Provider identifier.
name string Provider name.
enabled boolean Whether the provider can receive leads.
integration object or null The integration object as saved.
has_headers boolean true when at least one leg has stored headers.
secret_names array of strings Names of stored secrets, sorted alphabetically. Values are never returned.
header_leg_names array of strings Names of the legs that have stored headers, sorted alphabetically. Values and header names are never returned.
{
"id": "7d2f4a10-6b3e-4c91-8a5d-0e1f2a3b4c5d",
"name": "Northwind Mortgages",
"enabled": true,
"integration": {
"legs": [
{
"name": "post",
"role": "commit",
"request": {
"method": "POST",
"url": "https://buyer.example/post",
"fields": {
"Email": { "type": "field", "source": "payload.email" },
"Source": { "type": "static", "value": "pingdex" },
"ApiKey": { "type": "secret", "secret": "api_token" }
}
}
}
]
},
"has_headers": true,
"secret_names": ["api_token"],
"header_leg_names": ["post"]
}
GET /providers

Returns every provider in your account, ordered by name. The body is a JSON array. It is not paginated and has no envelope.

Scope: providers:manage

Parameters: none.

Status Meaning
200 An array of provider objects. Empty when you have none.
401 Missing, invalid or expired token.
403 The token does not have providers:manage.
Terminal window
curl https://api.pingdex.io/api/v1/providers \
--header "Authorization: Bearer $PINGDEX_API_KEY" \
--header "Accept: application/json"
POST /providers

Creates a provider. Pingdex compiles the integration, headers and secrets before saving. If any part fails to compile, nothing is saved.

Scope: providers:manage

Field Type Required Description
name string Yes Up to 255 characters.
integration object Yes A JSON object, never a JSON string. See the integration object.
enabled boolean No Defaults to false.
headers object or null No Static request headers, keyed by leg name. See Headers.
secrets object or null No Named secret values that field mappings can reference. See Secrets.
clear_header_legs array of strings or null No Leg names whose headers should be removed. Only useful on update.
clear_secret_names array of strings or null No Secret names that should be removed. Only useful on update.

Fields that are not listed are ignored without an error. That includes fields that look plausible but do not exist, such as clear_headers, mode or a top-level url. A provider has no mode and no top-level URL. URLs live inside the legs of integration.

Status Meaning
201 Created. The body is the provider object.
401 Missing, invalid or expired token.
403 The token does not have providers:manage.
422 Validation or compile failure. Nothing was saved. See Compile errors.

A single post leg, with an Authorization header and one secret.

Terminal window
curl https://api.pingdex.io/api/v1/providers \
--request POST \
--header "Authorization: Bearer $PINGDEX_API_KEY" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data '{
"name": "Northwind Mortgages",
"enabled": true,
"integration": {
"legs": [
{
"name": "post",
"role": "commit",
"request": {
"method": "POST",
"url": "https://buyer.example/post",
"fields": {
"Email": { "type": "field", "source": "payload.email" },
"Source": { "type": "static", "value": "pingdex" },
"ApiKey": { "type": "secret", "secret": "api_token" }
}
}
}
]
},
"headers": {
"post": { "Authorization": "Bearer sk_test_synthetic_0000" }
},
"secrets": {
"api_token": "tok_test_synthetic_1111"
}
}'

A ping quote leg followed by a post commit leg that sends back the transaction identifier from the ping.

Terminal window
curl https://api.pingdex.io/api/v1/providers \
--request POST \
--header "Authorization: Bearer $PINGDEX_API_KEY" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data '{
"name": "Fabrikam Home Loans",
"enabled": true,
"integration": {
"legs": [
{
"name": "ping",
"role": "quote",
"request": {
"method": "POST",
"url": "https://buyer.example/ping",
"fields": {
"Email": { "type": "field", "source": "payload.email" }
}
},
"response": {
"accepted": "accepted",
"bid": "bid",
"extract": { "transaction_id": "data.transaction_id" }
}
},
{
"name": "post",
"role": "commit",
"request": {
"method": "POST",
"url": "https://buyer.example/post",
"fields": {
"Email": { "type": "field", "source": "payload.email" },
"TransactionId": { "type": "response", "leg": "ping", "source": "transaction_id" }
}
},
"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"
}
}
]
},
"headers": {
"ping": { "X-Api-Key": "key_test_synthetic_2222" },
"post": { "X-Api-Key": "key_test_synthetic_2222" }
}
}'
GET /providers/{provider}

Returns one provider.

Scope: providers:manage

Parameter In Type Description
provider path string (UUID) The provider identifier.
Status Meaning
200 The provider object.
401 Missing, invalid or expired token.
403 The token does not have providers:manage.
404 No provider with this identifier in your account.
Terminal window
curl https://api.pingdex.io/api/v1/providers/7d2f4a10-6b3e-4c91-8a5d-0e1f2a3b4c5d \
--header "Authorization: Bearer $PINGDEX_API_KEY" \
--header "Accept: application/json"
PUT /providers/{provider}

Replaces the provider’s name, enabled flag and integration, and applies your header and secret changes. It is a full replacement of the provider definition, with the special rules for headers and secrets set out below.

Scope: providers:manage

Parameter Type Description
provider string (UUID) The provider identifier.

The same fields as create a provider. name and integration are required. Treat enabled as required too: if you omit it, the provider is set to enabled: false.

Field Effect on update
name Replaced.
enabled Replaced. Omitting it disables the provider.
integration Replaced in full.
headers Per-leg replace. See Headers. Omit to keep.
clear_header_legs Removes those legs’ stored headers.
secrets Per-name merge. See Secrets. Omit to keep.
clear_secret_names Removes those stored secrets.
  • Leg names. Names of existing legs cannot be renamed. See Leg names and headers.
  • Assigned campaigns. If the provider is assigned to a campaign, the new integration must still suit that campaign’s routing strategy. A highest_bid campaign needs a quote leg. A priority campaign needs a commit-only integration. Otherwise the update is refused with 422 on integration and nothing changes.
Status Meaning
200 Updated. The body is the provider object.
401 Missing, invalid or expired token.
403 The token does not have providers:manage.
404 No provider with this identifier in your account.
422 Validation or compile failure. Nothing was saved.

Example: change the name, keep every credential

Section titled “Example: change the name, keep every credential”

Omit headers, secrets, clear_header_legs and clear_secret_names and every stored header and secret stays as it was. Send the integration you want the provider to have.

Terminal window
curl https://api.pingdex.io/api/v1/providers/7d2f4a10-6b3e-4c91-8a5d-0e1f2a3b4c5d \
--request PUT \
--header "Authorization: Bearer $PINGDEX_API_KEY" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data '{
"name": "Northwind Mortgages (UK)",
"enabled": true,
"integration": {
"legs": [
{
"name": "post",
"role": "commit",
"request": {
"method": "POST",
"url": "https://buyer.example/post",
"fields": {
"Email": { "type": "field", "source": "payload.email" },
"Source": { "type": "static", "value": "pingdex" },
"ApiKey": { "type": "secret", "secret": "api_token" }
}
}
}
]
}
}'

Example: rotate a secret and clear a header

Section titled “Example: rotate a secret and clear a header”

Replace the value of api_token, and remove all stored headers from the post leg. Other secrets and other legs’ headers are untouched.

Terminal window
curl https://api.pingdex.io/api/v1/providers/7d2f4a10-6b3e-4c91-8a5d-0e1f2a3b4c5d \
--request PUT \
--header "Authorization: Bearer $PINGDEX_API_KEY" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data '{
"name": "Northwind Mortgages (UK)",
"enabled": true,
"integration": {
"legs": [
{
"name": "post",
"role": "commit",
"request": {
"method": "POST",
"url": "https://buyer.example/post",
"fields": {
"Email": { "type": "field", "source": "payload.email" },
"ApiKey": { "type": "secret", "secret": "api_token" }
}
}
}
]
},
"secrets": { "api_token": "tok_test_synthetic_3333" },
"clear_header_legs": ["post"]
}'
PATCH /providers/{provider}

PATCH has exactly the same body, validation, header and secret semantics and responses as PUT. It is not a partial update. name and integration are still required, and an omitted enabled still sets the provider to disabled.

Scope: providers:manage

Terminal window
curl https://api.pingdex.io/api/v1/providers/7d2f4a10-6b3e-4c91-8a5d-0e1f2a3b4c5d \
--request PATCH \
--header "Authorization: Bearer $PINGDEX_API_KEY" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data '{
"name": "Northwind Mortgages",
"enabled": false,
"integration": {
"legs": [
{
"name": "post",
"role": "commit",
"request": {
"method": "POST",
"url": "https://buyer.example/post",
"fields": {
"Email": { "type": "field", "source": "payload.email" },
"Source": { "type": "static", "value": "pingdex" },
"ApiKey": { "type": "secret", "secret": "api_token" }
}
}
}
]
}
}'

This example pauses the provider by setting enabled to false while keeping its integration, headers and secrets.

Headers are static request headers that Pingdex adds to every request on a leg. Use them for credentials such as Authorization or X-Api-Key.

headers is an object keyed by leg name. Each value is a non-empty object of header name to string value.

{
"headers": {
"ping": { "X-Api-Key": "key_test_synthetic_2222" },
"post": {
"Authorization": "Bearer sk_test_synthetic_0000",
"X-Account": "acct-synthetic-01"
}
}
}
What you send What happens
headers omitted, null or {} Every stored header is kept.
headers with a leg That leg’s headers are replaced by exactly what you send. Header names you leave out of that leg are removed.
headers without a leg That leg’s stored headers are kept.
clear_header_legs: ["post"] The post leg’s stored headers are removed.

To change one header on a leg, send every header you want that leg to keep, because a leg’s headers are replaced as a unit. Header values cannot be read back, so keep your own record of them.

Rules:

  • Each leg must exist in the integration you send, otherwise the error is configuration.headers.<leg>: unknown leg.
  • Each leg’s header object must be non-empty. To remove a leg’s headers, use clear_header_legs instead.
  • A leg cannot appear in both headers and clear_header_legs.
  • Header names must be valid HTTP tokens. Header values must be strings without carriage return, line feed or NUL characters.
  • These names are refused: Accept, Connection, Content-Length, Content-Type, Host and Transfer-Encoding. Pingdex sets them itself.

Leg names key the stored headers, the response references and the attempt records, so they are stable once saved.

  • You cannot rename a leg. Changing one leg’s name while keeping the same number of legs returns 422 with Persisted leg names cannot be renamed. Remove a leg and add a new one instead.
  • You can remove a leg, or add one, by changing the number of legs. Removing a leg also removes the headers stored for it.
  • Stored secrets belong to the provider, not to a leg, so they survive leg changes.

Secrets are named values that field mappings can reference with { "type": "secret", "secret": "<name>" }. The mapping holds only the name. The value never appears in the integration.

secrets is an object of secret name to a non-empty string value.

What you send What happens
secrets omitted, null or {} Every stored secret is kept.
secrets: { "api_token": "..." } api_token is added or replaced. Other stored secrets are kept.
clear_secret_names: ["api_token"] api_token is deleted.

Rules:

  • A secret name must be non-empty and must not contain ., carriage return or line feed.
  • A secret value must be a non-empty string. An empty string is refused with 422 and is never treated as a request to delete. The stored value stays unchanged.
  • A name cannot appear in both secrets and clear_secret_names.
  • Pingdex does not check at save time that every secret mapping names a stored secret. If a field references a secret that does not exist, the attempt records not_sent with missing_mapped_field. Check secret_names in the response after saving.

Pingdex compiles the integration, headers and secrets as it saves. The first problem found is returned as a 422 whose message reads path: reason. The error key is integration, headers or secrets, depending on the path.

{
"message": "legs.0.request.fields: empty",
"errors": {
"integration": ["legs.0.request.fields: empty"]
}
}
{
"message": "configuration.secrets.api_token: secret value must be a non-empty string",
"errors": {
"secrets": ["configuration.secrets.api_token: secret value must be a non-empty string"]
}
}
{
"message": "configuration.headers.post.X-Api-Key: header value must be a string",
"errors": {
"headers": ["configuration.headers.post.X-Api-Key: header value must be a string"]
}
}

Paths that begin configuration.headers use the key headers. Paths that begin configuration.secrets use the key secrets. Every other path uses integration. The paths and reasons for the integration object are in the integration object reference.

Other 422 responses on write:

Key Message Cause
integration The integration field is required. integration is missing.
integration, headers, secrets must be a JSON object The value is a JSON array or not an object.
clear_header_legs, clear_secret_names must be a JSON array of strings The value is not a list of non-empty strings.
headers each leg must have a non-empty header object A leg’s value is empty, a list or not an object.
clear_header_legs cannot clear and replace the same leg headers A leg is in both headers and clear_header_legs.
clear_secret_names cannot clear and replace the same secret A name is in both secrets and clear_secret_names.
integration Persisted leg names cannot be renamed. Remove a leg and add a new one instead. A leg was renamed on update.
integration This integration is not compatible with an assigned campaign routing strategy. The update would break an assigned campaign.

A failed write leaves the stored provider, headers and secrets exactly as they were.

Compiling checks the shape of the definition. Delivery applies stricter checks to the destination at the moment Pingdex calls the buyer:

  • In production, the URL must use https, even though the compiler also accepts http.
  • The host must resolve only to public internet addresses. Private, loopback and link-local addresses are refused.
  • A URL cannot include a username or password, or a fragment.
  • Redirects are not followed.
  • A few more header names are refused when sending: Keep-Alive, Proxy-Authenticate, Proxy-Authorization, TE, Trailers, Upgrade and Proxy-Connection.

A destination that fails these checks does not fail the save. It fails the attempt, which is recorded as not_sent with invalid_integration. See Limits and Troubleshooting providers.