# Create a lead form

Creates a lead form. Works with Meta Ads and LinkedIn Ads.

```http
POST https://api.pozy.ai/v1/ads/lead-forms
```

- Area: Ads / Lead Gen
- Auth: Authorization: Bearer pz_live_...

## Request body

Content type: `application/json`

- `accountId`, string, required
- `name`, string, required: Up to 200 characters
- `questions`, array of object: At least 1 item
  - `type`, string, required
  - `key`, string
  - `label`, string
  - `options`, array of object
    - `key`, string
    - `value`, string
  - `inline_context`, string
- `privacyPolicyUrl`, string (URL), required
- `privacyPolicyLinkText`, string: Up to 70 characters
- `followUpActionUrl`, string (URL)
- `locale`, string
- `thankYouTitle`, string
- `thankYouBody`, string
- `thankYouButtonText`, string
- `thankYouButtonType`, string
- `thankYouWebsiteUrl`, string (URL)
- `isOptimizedForQuality`, boolean
- `platformSpecificData`, object
  - one of: MetaLeadFormPlatformData
    - `questions`, array of object, required: At least 1 item
      - `type`, string, required
      - `key`, string
      - `label`, string
      - `options`, array of object
        - `key`, string
        - `value`, string
      - `inline_context`, string
    - `privacyPolicyLinkText`, string: Up to 70 characters
    - `followUpActionUrl`, string (URL)
    - `locale`, string
    - `thankYouTitle`, string
    - `thankYouBody`, string
    - `thankYouButtonText`, string
    - `thankYouButtonType`, string
    - `businessPhoneNumber`, string
    - `countryCode`, string: Matches `^[A-Za-z]{2}$`
    - `thankYouWebsiteUrl`, string (URL)
    - `thankYouEnableMessenger`, boolean: Default `false`
    - `isOptimizedForQuality`, boolean
    - `isPhoneSmsVerifyEnabled`, boolean: Default `false`
    - `blockDisplayForNonTargetedViewer`, boolean
    - `questionPageCustomHeadline`, string
    - `contextCard`, object
      - `title`, string
      - `content`, array of string
      - `style`, string: One of `LIST_STYLE`, `PARAGRAPH_STYLE`
      - `buttonText`, string
      - `coverPhoto`, string (URL)
    - `customDisclaimer`, object
      - `title`, string, required
      - `body`, string, required
      - `checkboxes`, array of object, required: At least 1 item
        - `key`, string, required
        - `text`, string, required
        - `isRequired`, boolean: Default `false`
        - `isCheckedByDefault`, boolean: Default `false`
  - one of: LinkedInLeadFormPlatformData
    - `adAccountId`, string, required
    - `headline`, string, required: Up to 255 characters
    - `description`, string, required: Up to 1500 characters
    - `state`, string: One of `DRAFT`, `PUBLISHED`
    - `locale`, object
      - `country`, string
      - `language`, string
    - `consents`, array of object
      - `description`, string, required
      - `required`, boolean: Default `false`
    - `questions`, array of object, required: At least 1 item
      - one of: Option 1
        - `kind`, string, required: One of `text`
        - `name`, string, required
        - `question`, string, required
        - `required`, boolean
        - `responseEditable`, boolean
        - `maxResponseLength`, integer
      - one of: Option 2
        - `kind`, string, required: One of `multipleChoice`
        - `name`, string, required
        - `question`, string, required
        - `required`, boolean
        - `responseEditable`, boolean
        - `choices`, array of object, required: At least 1 item
          - `id`, integer, required
          - `text`, string, required

## Example request

```bash
curl -X POST "https://api.pozy.ai/v1/ads/lead-forms" \
  -H "Authorization: Bearer $POZY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "accountId": "696e0b682d0a31188e7a2ba9",
  "name": "Acme",
  "privacyPolicyUrl": "https://pozy.ai/media/example-1.jpg"
}'
```

```ts
const res = await fetch("https://api.pozy.ai/v1/ads/lead-forms", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.POZY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    accountId: "696e0b682d0a31188e7a2ba9",
    name: "Acme",
    privacyPolicyUrl: "https://pozy.ai/media/example-1.jpg"
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(data?.error ?? `Request failed with status ${res.status}`);
console.log(data);
```

```python
import os
import requests

resp = requests.post(
    "https://api.pozy.ai/v1/ads/lead-forms",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    json={
        "accountId": "696e0b682d0a31188e7a2ba9",
        "name": "Acme",
        "privacyPolicyUrl": "https://pozy.ai/media/example-1.jpg",
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 200

- `status`, string
- `form`, object
  - `id`, string
  - `name`, string

```json
{
  "status": "active",
  "form": {
    "id": "6bfebd43ddc270f6d2c56fc5",
    "name": "Acme"
  }
}
```
