Skip to content

Quickstart

This guide takes you from a new account to a delivered lead. You will create a provider that uses direct post, a priority campaign that routes to it, and submit one lead with curl.

All examples use synthetic data. Replace the buyer URL, token and identifiers with your own values.

  1. Create an account

    Register in the Pingdex app. Registration creates your account and your first user. Everything you create next belongs to that account.

  2. Create an API key

    In the app, go to Settings, then API keys, and create a key. Select these scopes:

    Scope Used in this guide to
    providers:manage Create the provider
    campaigns:manage Create the campaign
    leads:ingest Submit a lead
    leads:read Read the lead back

    Copy the token when it is shown. Then set it in your shell. The value below is fictional.

    Terminal window
    export PINGDEX_TOKEN="pdx_example_4f8a1c2e9b7d"

    See API keys and API authentication.

  3. Create a direct-post provider

    A direct-post provider has an integration with a single commit leg. This one sends the lead’s email address and a static source value to a buyer endpoint, and authenticates with a secret.

    Terminal window
    curl -X POST https://api.pingdex.io/api/v1/providers \
    -H "Authorization: Bearer $PINGDEX_TOKEN" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{
    "name": "Example Buyer",
    "enabled": true,
    "integration": {
    "legs": [
    {
    "name": "post",
    "role": "commit",
    "request": {
    "method": "POST",
    "url": "https://buyer.example/leads",
    "fields": {
    "Email": { "type": "field", "source": "payload.email" },
    "FirstName": { "type": "field", "source": "payload.first_name" },
    "Source": { "type": "static", "value": "pingdex" },
    "ApiKey": { "type": "secret", "secret": "api_token" }
    }
    }
    }
    ]
    },
    "secrets": {
    "api_token": "example-buyer-api-token"
    }
    }'

    The response includes the provider id. Keep it for the next step. Secret values are never returned. The response lists only the secret names.

    {
    "id": "01932a1e-7c3a-7000-8000-000000000020",
    "name": "Example Buyer",
    "enabled": true
    }

    Pingdex compiles the integration before saving it. If the integration is invalid, you receive a 422 response with the path and reason, and nothing is saved. See Create a provider and Integration specification.

  4. Create a priority campaign with a schema

    A priority campaign commits to the first eligible provider in assignment order, so it requires commit-only providers. The schema describes the fields a lead must carry. provider_ids lists providers in priority order.

    Terminal window
    curl -X POST https://api.pingdex.io/api/v1/campaigns \
    -H "Authorization: Bearer $PINGDEX_TOKEN" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{
    "name": "Example campaign",
    "enabled": true,
    "routing_strategy": "priority",
    "schema": [
    { "name": "first_name", "type": "string", "required": true },
    { "name": "email", "type": "string", "required": true },
    { "name": "age", "type": "integer", "required": false }
    ],
    "provider_ids": ["01932a1e-7c3a-7000-8000-000000000020"]
    }'

    The response includes the campaign id. This guide uses 01932a1e-7c3a-7000-8000-000000000010 as an example.

    See Create a campaign and Lead schema.

  5. Submit a lead

    Send the campaign’s campaign_id and a JSON object as payload. external_id is optional and lets you correlate the lead with your own records. The Idempotency-Key header is optional and makes it safe to retry the request.

    Terminal window
    curl -X POST https://api.pingdex.io/api/v1/leads \
    -H "Authorization: Bearer $PINGDEX_TOKEN" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -H "Idempotency-Key: quickstart-0001" \
    -d '{
    "campaign_id": "01932a1e-7c3a-7000-8000-000000000010",
    "external_id": "web-form-1001",
    "payload": {
    "first_name": "Alex",
    "email": "alex@example.com",
    "age": 34
    }
    }'

    Pingdex responds with 202 and the lead’s id. Processing continues after the response, so the status is received at this point.

    {
    "id": "01932a1e-7c3a-7000-8000-000000000001",
    "status": "received"
    }

    The request body accepts only campaign_id, payload and external_id. Any other top-level field is rejected. See Submit a lead and Leads API.

  6. Check the lead

    Open the lead in the dashboard, or read it with the API using the leads:read scope.

    Terminal window
    curl "https://api.pingdex.io/api/v1/leads?external_id=web-form-1001" \
    -H "Authorization: Bearer $PINGDEX_TOKEN" \
    -H "Accept: application/json"

    Look at status and, if the provider has a commit response mapping, commercial_status. To see each contact with a provider, request the lead’s attempts:

    Terminal window
    curl https://api.pingdex.io/api/v1/leads/01932a1e-7c3a-7000-8000-000000000001/attempts \
    -H "Authorization: Bearer $PINGDEX_TOKEN" \
    -H "Accept: application/json"

    A lead whose commit received a successful HTTP response has the status delivered. Read Lifecycle and statuses for every outcome.

Symptom Likely cause
401 The token is missing, wrong or expired.
403 The key lacks the scope for that endpoint.
422 on lead submission The campaign is disabled or belongs to another account, or the payload does not match the schema.
Lead status failed with no attempt No eligible provider. Check that the provider and campaign are enabled and that the provider is assigned to the campaign.
409 on lead submission The Idempotency-Key was already used with a different request.

See API errors and Lead troubleshooting.