> ## 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 lead form

> Create a new LinkedIn lead gen form for an ad account

Create a new LinkedIn lead gen form for an ad account

```http theme={null}
POST https://services.leadconnectorhq.com/ad-publishing/linkedin/{accountId}/form
```

## 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>

## Query parameters

<ParamField query="locationId" type="string" required default="HChooFuiyPpVYzeJ4HMe">
  Account identifier
</ParamField>

## Body

<ParamField body="owner" type="object" required>
  Form owner
</ParamField>

<ParamField body="creationLocale" type="object" required>
  Creation locale
</ParamField>

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

<ParamField body="state" type="string" required default="PUBLISHED">
  Form state Posibles valores: 'PUBLISHED'
</ParamField>

<ParamField body="content" type="object" required>
  Form content
</ParamField>

<ParamField body="hiddenFields" type="object[]">
  Hidden fields

  <Expandable title="cada item">
    <ParamField body="name" type="string" required default="utm_source">
      Field name
    </ParamField>

    <ParamField body="value" type="string" required default="linkedin">
      Field value
    </ParamField>
  </Expandable>
</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/linkedin/YOUR_accountId/form' \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Version: 2021-07-28' \
    -H 'Content-Type: application/json' \
    -d '{
    "name": "Contact Us",
    "state": "PUBLISHED",
    "hiddenFields": [
      {
        "name": "utm_source",
        "value": "linkedin"
      }
    ]
  }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://services.leadconnectorhq.com/ad-publishing/linkedin/YOUR_accountId/form', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
      Version: '2021-07-28',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({"name": "Contact Us", "state": "PUBLISHED", "hiddenFields": [{"name": "utm_source", "value": "linkedin"}]}),
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import os, requests
  response = requests.request(
      'POST',
      'https://services.leadconnectorhq.com/ad-publishing/linkedin/YOUR_accountId/form',
      headers={
          'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
          'Version': '2021-07-28',
          'Content-Type': 'application/json',
      },
      json={"name": "Contact Us", "state": "PUBLISHED", "hiddenFields": [{"name": "utm_source", "value": "linkedin"}]},
  )
  data = response.json()
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://services.leadconnectorhq.com/ad-publishing/linkedin/YOUR_accountId/form');
  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({'name': 'Contact Us', 'state': 'PUBLISHED', 'hiddenFields': [{'name': 'utm_source', 'value': 'linkedin'}]}),
  ]);
  $data = json_decode(curl_exec($ch), true);
  ```
</CodeGroup>
