{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pipecorn-com/json-schema/pipecorn-com-enrichment-request-schema.json",
  "title": "EnrichmentRequest",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pipecorn-com-openapi.json#/components/schemas/EnrichmentRequest",
  "type": "object",
  "properties": {
    "webhook_url": {
      "type": "string",
      "format": "uri",
      "description": "Webhook URL to receive enrichment results"
    },
    "phone_country_codes": {
      "type": "array",
      "items": {
        "type": "string",
        "description": "ISO 3166-1 alpha-2 country code (e.g. \"US\", \"FR\", \"GB\")"
      },
      "description": "Optional. Restrict phone enrichment to phone numbers from these countries. When omitted, the user's account-level default phone country codes are applied."
    },
    "phone_type": {
      "type": "array",
      "maxItems": 1,
      "items": {
        "type": "string",
        "enum": [
          "all",
          "mobile"
        ]
      },
      "default": [
        "all"
      ],
      "description": "Optional. Filters the phone numbers returned by phone enrichment. `[\"all\"]` (default) returns every number found; `[\"mobile\"]` returns only mobile numbers (`type` of `mobile` or `fixed_or_mobile`) and drops landlines, VoIP, toll-free and other non-mobile numbers. With `[\"mobile\"]` the waterfall keeps querying providers until one returns a mobile number. Any other value is rejected with `422`. Ignored unless `enrichment_type` includes `phone`."
    },
    "custom": {
      "type": "object",
      "description": "Custom fields to include with the enrichment that will be returned in the webhook (like crm id, etc.)",
      "additionalProperties": true
    }
  },
  "oneOf": [
    {
      "title": "Email enrichment",
      "required": [
        "enrichment_type",
        "firstname",
        "lastname"
      ],
      "properties": {
        "enrichment_type": {
          "type": "array",
          "maxItems": 1,
          "items": {
            "type": "string",
            "enum": [
              "email"
            ]
          },
          "description": "Set to [\"email\"] to find and validate the professional email."
        },
        "firstname": {
          "type": "string",
          "description": "First name of the contact."
        },
        "lastname": {
          "type": "string",
          "description": "Last name of the contact."
        },
        "linkedin_url": {
          "type": "string",
          "format": "uri",
          "description": "LinkedIn profile URL of the contact."
        },
        "domain": {
          "type": "string",
          "description": "Company domain."
        },
        "company_name": {
          "type": "string",
          "description": "Company name."
        }
      },
      "anyOf": [
        {
          "required": [
            "linkedin_url"
          ]
        },
        {
          "required": [
            "domain"
          ]
        },
        {
          "required": [
            "company_name"
          ]
        }
      ],
      "description": "Requires `firstname`, `lastname`, and at least one identifier: `linkedin_url`, `domain`, or `company_name`."
    },
    {
      "title": "Phone enrichment",
      "required": [
        "enrichment_type",
        "linkedin_url"
      ],
      "properties": {
        "enrichment_type": {
          "type": "array",
          "maxItems": 1,
          "items": {
            "type": "string",
            "enum": [
              "phone"
            ]
          },
          "description": "Set to [\"phone\"] to find phone numbers."
        },
        "linkedin_url": {
          "type": "string",
          "format": "uri",
          "description": "LinkedIn profile URL of the contact."
        }
      },
      "description": "Requires only the contact's `linkedin_url` (`firstname`/`lastname` are not needed)."
    },
    {
      "title": "Personal email enrichment",
      "required": [
        "enrichment_type",
        "linkedin_url"
      ],
      "properties": {
        "enrichment_type": {
          "type": "array",
          "maxItems": 1,
          "items": {
            "type": "string",
            "enum": [
              "personal_email"
            ]
          },
          "description": "Set to [\"personal_email\"]. Requires per-user GDPR consent."
        },
        "linkedin_url": {
          "type": "string",
          "format": "uri",
          "description": "LinkedIn profile URL of the contact."
        }
      },
      "description": "Requires the contact's `linkedin_url` and account-level GDPR consent (`firstname`/`lastname` are not needed)."
    }
  ]
}