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

# Create Subscription

> Create device based subscriptions.

<Warning>
  A single user can have up to **10** subscriptions on different devices.
</Warning>

#### Body Parameters

<ParamField body="notification_channel" type="string" required> Declare which notification channels could be used to notify user about events. Possible values are: `apns`, `apns_voip`, `gcm`, and `email`. </ParamField>

<ParamField body="push_token" type="object">
  <Expandable title="properties">
    <ParamField body="environment" type="string" required> Determine application mode. It allows conveniently separate development and production modes. Possible values are: `development` and `production`. </ParamField>
    <ParamField body="bundle_identifier" type="string"> A unique identifier for client's application. In iOS, this is a Bundle Identifier. In Android, a package ID. </ParamField>
    <ParamField body="client_identification_sequence" type="string" required> A device registration token generated by the APNs or GCM/FCM. The token can be unregistered by the APNs or GCM/FCM anytime. In this case, the device should be registered again and obtain a new token. When a new token is obtained, a new subscription should be created. </ParamField>
  </Expandable>
</ParamField>

<ParamField body="device" type="object">
  <Expandable title="properties">
    <ParamField body="platform" type="string" required> Platform of the device, which is the source of application running. Possible values are: `ios` and `android`. </ParamField>
    <ParamField body="udid" type="string" required> UDID (Unique Device Identifier) of the device that is the source of application running. This must be any sequence uniquely identifying a particular device. This is needed to support schema: 1 User => Multiple devices. </ParamField>
  </Expandable>
</ParamField>

#### Headers

<ParamField header="QB-Token" type="string" required> A user or application session token. See [Authentication](/reference/authentication) page to learn more about session tokens. Must be used either QB-Token or Authorization. </ParamField>

#### Responses

<AccordionGroup>
  <Accordion title="201">
    A successful response.

    <Expandable title="array of objects">
      <ResponseField name="subscription" type="object">
        <Expandable title="properties">
          <ResponseField name="id" type="integer" />

          <ResponseField name="device" type="object">
            <Expandable title="properties">
              <ResponseField name="udid" type="string" />

              <ResponseField name="client_identification_sequence" type="string" />

              <ResponseField name="platform" type="object">
                <Expandable title="properties">
                  <ResponseField name="name" type="string" />
                </Expandable>
              </ResponseField>

              <ResponseField name="bundle_identifier" type="string" />
            </Expandable>
          </ResponseField>

          <ResponseField name="notification_channel" type="object">
            <Expandable title="notification_channel">
              <ResponseField name="name" type="string" />
            </Expandable>
          </ResponseField>
        </Expandable>
      </ResponseField>
    </Expandable>
  </Accordion>

  <Accordion title="422">
    An error response

    <ResponseField name="errors" type="object">
      <Expandable title="properties">
        <ResponseField name="environment" type="array of strings" />

        <ResponseField name="client_identification_sequence" type="array of strings" />
      </Expandable>
    </ResponseField>
  </Accordion>
</AccordionGroup>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST \
  -H "Content-Type: application/json" \
  -H "QB-Token: 1e0bad9d9830c038ea19f12d83fca4e984012bba" \
  -d '{  
    "notification_channel":"apns",
    "push_token":{  
      "environment":"development",
      "client_identification_sequence":"1054929587f29c856fa0137f634cc0a5ec77901f4baaf2f3c1785d05ae114455",
      "bundle_identifier":"com.quickblox.myawesomeapp"
    },
    "device":{  
      "platform":"ios",
      "udid":"2343af3433aa3a4fsv"
    }
  }' \
  https://api.quickblox.com/subscriptions.json
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={null}
  [
    {
      "subscription": {
        "id": 59715257,
        "device": {
          "udid": "2343af3433aa3a4fsv",
          "client_identification_sequence": "1054929587f29c856fa0137f634cc0a5ec77901f4baaf2f3c1785d05ae114455",
          "platform": {
            "name": "ios"
          },
          "bundle_identifier": "com.quickblox.myawesomeapp"
        },
        "notification_channel": {
          "name": "apns"
        }
      }
    }
  ]
  ```

  ```json 422 theme={null}
  {
    "errors": {
      "environment": [
        "is not included in the list (production, development)"
      ],
      "client_identification_sequence": [
        "is invalid"
      ]
    }
  }
  ```
</ResponseExample>
