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

> Create a new custom subtype for a account. Requires agency or account admin role.

Create a new custom subtype for a account. Requires agency or account admin role.

```http theme={null}
POST https://services.leadconnectorhq.com/conversations/preferences/custom-subtypes
```

## 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="ve9EPM428h8vShlRW1KT">
  Account Id
</ParamField>

## Body

<ParamField body="name" type="string" required default="Newsletter Subscription">
  Name of the custom subtype (max 100 characters)
</ParamField>

<ParamField body="description" type="string" default="Weekly newsletter subscription preferences">
  Description of the custom subtype (max 100 characters)
</ParamField>

<ParamField body="channel" type="string" required default="email">
  Communication channel Posibles valores: 'email', 'sms'
</ParamField>

<ParamField body="language" type="string" required default="en">
  Language code
</ParamField>

## Respuestas

<Accordion title="200 - Successful response" />

<Accordion title="201 - Response" />

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

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

## Ejemplo

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST 'https://services.leadconnectorhq.com/conversations/preferences/custom-subtypes' \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Version: 2021-07-28' \
    -H 'Content-Type: application/json' \
    -d '{
    "name": "Newsletter Subscription",
    "description": "Weekly newsletter subscription preferences",
    "channel": "email",
    "language": "en"
  }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://services.leadconnectorhq.com/conversations/preferences/custom-subtypes', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
      Version: '2021-07-28',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({"name": "Newsletter Subscription", "description": "Weekly newsletter subscription preferences", "channel": "email", "language": "en"}),
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import os, requests
  response = requests.request(
      'POST',
      'https://services.leadconnectorhq.com/conversations/preferences/custom-subtypes',
      headers={
          'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
          'Version': '2021-07-28',
          'Content-Type': 'application/json',
      },
      json={"name": "Newsletter Subscription", "description": "Weekly newsletter subscription preferences", "channel": "email", "language": "en"},
  )
  data = response.json()
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://services.leadconnectorhq.com/conversations/preferences/custom-subtypes');
  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': 'Newsletter Subscription', 'description': 'Weekly newsletter subscription preferences', 'channel': 'email', 'language': 'en'}),
  ]);
  $data = json_decode(curl_exec($ch), true);
  ```
</CodeGroup>
