> ## Documentation Index
> Fetch the complete documentation index at: https://developers.leadwaycrm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create page lead form

> Create a new lead gen form on a Facebook page

Create a new lead gen form on a Facebook page

```http theme={null}
POST https://services.leadconnectorhq.com/ad-publishing/facebook/page/{pageId}/forms
```

## Autorización

<ParamField header="Authorization" type="string" required>
  Bearer token generado desde el portal Leadway. Ver [Autenticación](/authentication).
</ParamField>

<ParamField header="Version" type="string" required default="2021-07-28">
  Versión de la API.
</ParamField>

## Path parameters

<ParamField path="pageId" type="string" required default="103456789012345">
  Facebook page identifier
</ParamField>

## Body

<ParamField body="type" type="string" required default="MORE_VOLUME">
  Lead form type Posibles valores: 'MORE\_VOLUME', 'HIGHER\_INTENT'
</ParamField>

<ParamField body="name" type="string" required default="Contact Form">
  Lead form name
</ParamField>

<ParamField body="locationId" type="string" required default="loc_abc123">
  Account identifier
</ParamField>

<ParamField body="greetingCard" type="object">
  Greeting card config
</ParamField>

<ParamField body="questions" type="object[]" required>
  List of questions displayed on the lead form

  <Expandable title="cada item">
    <ParamField body="label" type="string" default="What is your name?">
      Question label text shown to the user
    </ParamField>

    <ParamField body="key" type="string" required default="name">
      Question key
    </ParamField>

    <ParamField body="type" type="string" required default="SHORT_ANSWER">
      Question input type — use a prefilled type for standard fields or CUSTOM / SHORT\_ANSWER for freeform questions Posibles valores: 'CUSTOM', 'CITY', 'COMPANY\_NAME', 'COUNTRY', 'DATE\_OF\_BIRTH', 'EMAIL', 'FIRST\_NAME', 'FULL\_NAME', 'GENDER', 'JOB\_TITLE', 'LAST\_NAME', 'MARITAL\_STATUS', 'MILITARY\_STATUS', 'PHONE', 'POST\_CODE', 'RELATIONSHIP\_STATUS', 'STATE', 'STREET\_ADDRESS', 'WORK\_EMAIL', 'WORK\_PHONE\_NUMBER', 'ZIP', 'SHORT\_ANSWER'
    </ParamField>

    <ParamField body="options" type="object[]">
      Answer options for multiple-choice questions (only applies to CUSTOM type)

      <Expandable title="cada item">
        <ParamField body="key" type="string" required default="option 1">
          Option key
        </ParamField>

        <ParamField body="value" type="string" required default="Option 1">
          Option value
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="questionPageHeadline" type="string" default="Tell us about yourself">
  Question page headline
</ParamField>

<ParamField body="privacyPolicyLink" type="string" required default="https://example.com/privacy">
  Privacy policy URL
</ParamField>

<ParamField body="privacyPolicyText" type="string" default="We respect your privacy">
  Privacy policy text
</ParamField>

<ParamField body="customDisclaimer" type="object">
  Custom disclaimer config
</ParamField>

<ParamField body="thankYouPage" type="object" required>
  Thank you page config
</ParamField>

## Respuestas

<Accordion title="201 - Response" />

<Accordion title="400 - Bad Request">
  ```json theme={null}
  {}
  ```
</Accordion>

<Accordion title="401 - Unauthorized">
  ```json theme={null}
  {}
  ```
</Accordion>

<Accordion title="422 - Unprocessable Entity">
  ```json theme={null}
  {}
  ```
</Accordion>

## Ejemplo

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST 'https://services.leadconnectorhq.com/ad-publishing/facebook/page/YOUR_pageId/forms' \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Version: 2021-07-28' \
    -H 'Content-Type: application/json' \
    -d '{
    "type": "MORE_VOLUME",
    "name": "Contact Form",
    "locationId": "loc_abc123",
    "questions": [
      {
        "key": "full_name",
        "type": "FULL_NAME",
        "options": []
      },
      {
        "key": "email_address",
        "type": "EMAIL",
        "options": []
      },
      {
        "key": "are_you_interested",
        "label": "Are you interested?",
        "type": "CUSTOM",
        "options": [
          {
            "value": "Yes"
          },
          {
            "value": "No"
          }
        ]
      }
    ],
    "questionPageHeadline": "Tell us about yourself",
    "privacyPolicyLink": "https://example.com/privacy",
    "privacyPolicyText": "We respect your privacy"
  }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://services.leadconnectorhq.com/ad-publishing/facebook/page/YOUR_pageId/forms', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
      Version: '2021-07-28',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({"type": "MORE_VOLUME", "name": "Contact Form", "locationId": "loc_abc123", "questions": [{"key": "full_name", "type": "FULL_NAME", "options": []}, {"key": "email_address", "type": "EMAIL", "options": []}, {"key": "are_you_interested", "label": "Are you interested?", "type": "CUSTOM", "options": [{"value": "Yes"}, {"value": "No"}]}], "questionPageHeadline": "Tell us about yourself", "privacyPolicyLink": "https://example.com/privacy", "privacyPolicyText": "We respect your privacy"}),
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import os, requests
  response = requests.request(
      'POST',
      'https://services.leadconnectorhq.com/ad-publishing/facebook/page/YOUR_pageId/forms',
      headers={
          'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
          'Version': '2021-07-28',
          'Content-Type': 'application/json',
      },
      json={"type": "MORE_VOLUME", "name": "Contact Form", "locationId": "loc_abc123", "questions": [{"key": "full_name", "type": "FULL_NAME", "options": []}, {"key": "email_address", "type": "EMAIL", "options": []}, {"key": "are_you_interested", "label": "Are you interested?", "type": "CUSTOM", "options": [{"value": "Yes"}, {"value": "No"}]}], "questionPageHeadline": "Tell us about yourself", "privacyPolicyLink": "https://example.com/privacy", "privacyPolicyText": "We respect your privacy"},
  )
  data = response.json()
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://services.leadconnectorhq.com/ad-publishing/facebook/page/YOUR_pageId/forms');
  curl_setopt_array($ch, [
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_CUSTOMREQUEST => 'POST',
      CURLOPT_HTTPHEADER => [
          'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
          'Version: 2021-07-28',
          'Content-Type: application/json',
      ],
      CURLOPT_POSTFIELDS => json_encode({'type': 'MORE_VOLUME', 'name': 'Contact Form', 'locationId': 'loc_abc123', 'questions': [{'key': 'full_name', 'type': 'FULL_NAME', 'options': []}, {'key': 'email_address', 'type': 'EMAIL', 'options': []}, {'key': 'are_you_interested', 'label': 'Are you interested?', 'type': 'CUSTOM', 'options': [{'value': 'Yes'}, {'value': 'No'}]}], 'questionPageHeadline': 'Tell us about yourself', 'privacyPolicyLink': 'https://example.com/privacy', 'privacyPolicyText': 'We respect your privacy'}),
  ]);
  $data = json_decode(curl_exec($ch), true);
  ```
</CodeGroup>
