# Bulk Create/Update Subscribers

When creating or updating many subscribers at one time with the [Create Subscriber](https://developers.mobile-text-alerts.com/tutorials/manage-subscribers/..#create-subscriber-api-endpoint) and [Update Subscriber ](https://developers.mobile-text-alerts.com/tutorials/manage-subscribers/..#update-subscriber-api-endpoint)endpoints you can quickly exhaust the available [rate limit](https://developers.mobile-text-alerts.com/api-basics/rate-limits). The [Bulk Create Subscribers](#bulk-create-subscribers) and [Bulk Update Subscribers](#bulk-update-subscribers) endpoints are recommended for handling large subscriber changes via the API, this can save on both request round trip time and overall API call volume.

## Bulk Create Subscribers

This endpoint is used to create (or update and create) many subscriber accounts in one request.

### `CreateOnly` Parameter

If set to `true` the `createOnly` path parameter indicates the only action should be to create new subscribers and will not update records of existing subscribers. If set to `false` then both creating or updating (if the subscriber exists) actions will be performed.

### Subscriber Request Body

Records of subscribers should be in an array.&#x20;

*Required Fields for new subscribers:* `email` *or* `number`

<table><thead><tr><th width="186.5">Name</th><th width="170.5">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>firstName</code></td><td><code>string</code></td><td>First name of the subscriber.</td></tr><tr><td><code>lastName</code></td><td><code>string</code></td><td>Last name of the subscriber.</td></tr><tr><td><code>number</code><em>(required if no email)</em></td><td><code>number</code></td><td>Phone number of the subscriber.</td></tr><tr><td><code>email</code> <em>(required if no number)</em></td><td><code>string</code></td><td>Email address of the subscriber.</td></tr><tr><td><code>e164Number</code></td><td><code>string</code></td><td><p>E.164 international telephone number of the subscriber. If supplied, will be used over <code>number</code> .</p><p></p><p><em>E.164 Format:</em> </p><p>[+] [country code] [subscriber number including area code] (max. 15 digits)</p></td></tr><tr><td><code>groupIds</code></td><td><code>number[]</code></td><td>List of group ids of the groups the subscriber belongs to.</td></tr><tr><td><code>subscriberFields</code></td><td><code>dictionary</code>: <code>subscriberFieldIds:string</code> as the keys and <code>data: string</code> corresponding values</td><td><p>A dictionary of key value pairs of additional <a href="assign-custom-subscriber-attributes">custom subscriber attributes</a> for the subscriber.</p><p></p><p><em>Example:</em> </p><pre class="language-curl"><code class="lang-curl">"subscriberFields": {
<strong>    "2000": "January 1st, 2000",
</strong><strong>    "2001": "Custom Field Data"
</strong>}
</code></pre></td></tr></tbody></table>

## Bulk Create Subscribers

> \# Record Limit\
> \
> This endpoint will accept a maximum of \`1,000\` records in a single request. Records of subscribers should be in an array. The \`createOnly\` field indicates if the action is creating new subscribers only (doesn't accept records of existing subscribers) or the action is creating or updating (accept records of existing subscribers and update info according to the records).\
> \
> \
> \# Rate Limiting\
> \
> This endpoint overrides the general rate limit with an account rate limit. Requests are limited by the authenticated account instead of the IP address. This endpoint is limited to \`15\` requests every \`15\` seconds

```json
{"openapi":"3.0.0","info":{"title":"Mobile Text Alerts API","version":"8.0.0"},"servers":[{"url":"https://api.mobile-text-alerts.com/v3"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"apiKey"}},"schemas":{"BulkCreateSubscribers.Response":{"allOf":[{"$ref":"#/components/schemas/IApiResponse"},{"type":"object","properties":{"data":{"type":"object","properties":{"totalRecordCount":{"type":"number"},"createdRecordCount":{"type":"number"},"errorRecordCount":{"type":"number"},"createdRecords":{"type":"array","items":{"$ref":"#/components/schemas/IPublicNumber"}},"errorRecords":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/CreateSubscriber.Request"},{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}],"description":"BulkCreateSubscribers.ErrorRecord"}}},"required":["totalRecordCount","createdRecordCount","errorRecordCount","createdRecords","errorRecords"]}},"required":["data"]}]},"IApiResponse":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"string"},"message":{"type":"string"},"data":{}},"required":[]},"IPublicNumber":{"type":"object","properties":{"id":{"type":"number"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"number":{"type":"number"},"e164Number":{"type":"string"},"date":{"oneOf":[{"format":"date-time","type":"string"},{"type":"string"}]},"countryId":{"type":"number"},"groups":{"type":"array","items":{"$ref":"#/components/schemas/IPublicGroupName"}},"subscriberFieldData":{"type":"array","items":{"$ref":"#/components/schemas/IPublicSubscriberFieldDatum"}},"signupMethod":{"type":"number","nullable":true},"longNumber":{"type":"number"},"carrierId":{"type":"number"}},"required":["id","firstName","lastName","email","number","date","countryId","groups","subscriberFieldData","signupMethod","longNumber","carrierId"]},"IPublicGroupName":{"type":"object","properties":{"id":{"type":"number"},"name":{"type":"string"},"addedToGroupAt":{"oneOf":[{"format":"date-time","type":"string"},{"type":"string"}]}},"required":["id","name"]},"IPublicSubscriberFieldDatum":{"type":"object","properties":{"id":{"type":"number"},"subscriberFieldId":{"type":"number"},"data":{"type":"string"}},"required":["id","subscriberFieldId","data"]},"CreateSubscriber.Request":{"$ref":"#/components/schemas/INewNumber"},"INewNumber":{"type":"object","properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"number":{"oneOf":[{"type":"number"},{"type":"string"}]},"e164Number":{"type":"string"},"groupIds":{"type":"array","items":{"type":"number"}},"subscriberFields":{"type":"object","additionalProperties":{"type":"string"}},"employeeNumber":{"type":"string"},"welcomeMessage":{"type":"string"}},"required":[]},"BulkCreateSubscribers.Request":{"type":"array","items":{"$ref":"#/components/schemas/CreateSubscriber.Request"}}},"responses":{"BadRequestError":{"description":"BadRequestError","content":{"application/json":{"schema":{"type":"object","properties":{"httpCode":{"type":"number","enum":[400]},"message":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"type":{"type":"string","enum":["bad_request_error"]},"name":{"type":"string","enum":["MTABadRequestError"]},"requestId":{"type":"string","format":"uuid"}}}}}},"UnauthorizedError":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"type":"object","properties":{"httpCode":{"type":"number","enum":[401]},"message":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"type":{"type":"string","enum":["unauthorized_error"]},"name":{"type":"string","enum":["MTAUnauthorizedError"]},"requestId":{"type":"string","format":"uuid"}}}}}},"ForbiddenError":{"description":"ForbiddenError","content":{"application/json":{"schema":{"type":"object","properties":{"httpCode":{"type":"number","enum":[403]},"message":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"type":{"type":"string","enum":["forbidden_error"]},"name":{"type":"string","enum":["MTAForbiddenError"]},"requestId":{"type":"string","format":"uuid"},"reason":{}}}}}},"RateLimitError":{"description":"RateLimitError","content":{"application/json":{"schema":{"type":"object","properties":{"httpCode":{"type":"number","enum":[429]},"message":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"type":{"type":"string","enum":["rate_limit_error"]},"name":{"type":"string","enum":["MTARateLimitError"]},"requestId":{"type":"string","format":"uuid"}}}}}},"InternalServerError":{"description":"InternalServerError","content":{"application/json":{"schema":{"type":"object","properties":{"httpCode":{"type":"number","enum":[500]},"message":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"type":{"type":"string","enum":["internal_server_error"]},"name":{"type":"string","enum":["MTAInternalServerError"]},"requestId":{"type":"string","format":"uuid"}}}}}}}},"paths":{"/subscribers/bulk":{"post":{"tags":["Subscribers"],"summary":"Bulk Create Subscribers","description":"# Record Limit\n\nThis endpoint will accept a maximum of `1,000` records in a single request. Records of subscribers should be in an array. The `createOnly` field indicates if the action is creating new subscribers only (doesn't accept records of existing subscribers) or the action is creating or updating (accept records of existing subscribers and update info according to the records).\n\n\n# Rate Limiting\n\nThis endpoint overrides the general rate limit with an account rate limit. Requests are limited by the authenticated account instead of the IP address. This endpoint is limited to `15` requests every `15` seconds","operationId":"subscribers_bulk_create_subscribers","responses":{"200":{"description":"Success","headers":{"RateLimit-Limit":{"description":"The maximum number of requests that the consumer is permitted to make per window","schema":{"type":"integer"}},"RateLimit-Remaining":{"description":"The number of requests remaining in the current rate limit window","schema":{"type":"integer"}},"RateLimit-Reset":{"description":"The remaining window before the rate limit resets in milliseconds","schema":{"type":"integer"}},"Retry-After":{"description":"The number of seconds to wait before retrying the request","schema":{"type":"integer"}},"X-RateLimit-Limit":{"description":"The maximum number of requests that the consumer is permitted to make per window","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"The number of requests remaining in the current rate limit window","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"The remaining window before the rate limit resets in milliseconds","schema":{"type":"integer"}},"X-Request-ID":{"description":"A unique identifier for the request","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkCreateSubscribers.Response"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"},"429":{"$ref":"#/components/responses/RateLimitError"},"500":{"$ref":"#/components/responses/InternalServerError"}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkCreateSubscribers.Request"}}},"required":true},"parameters":[{"name":"createOnly","in":"query","required":false,"schema":{"type":"string"}}]}}}}
```

## Bulk Update Subscribers

This endpoint is used to update many subscriber accounts in one request. The `number` field is used to identify the subscriber record to be updated , if no `number` is provided then  `email` will be used an identifier. One of these fields must be provided to identify the subscriber record to be updated.&#x20;

### Subscriber Request Body

Records of subscribers should be in an array.&#x20;

<table><thead><tr><th width="186.5">Name</th><th width="170.5">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>firstName</code></td><td><code>string</code></td><td>First name of the subscriber.</td></tr><tr><td><code>lastName</code></td><td><code>string</code></td><td>Last name of the subscriber.</td></tr><tr><td><code>number</code></td><td><code>number</code></td><td>Phone number of the subscriber.</td></tr><tr><td><code>email</code> </td><td><code>string</code></td><td>Email address of the subscriber.</td></tr><tr><td><code>e164Number</code></td><td><code>string</code></td><td><p>E.164 international telephone number of the subscriber. If supplied, will be used over <code>number</code> .</p><p></p><p><em>E.164 Format:</em> </p><p>[+] [country code] [subscriber number including area code] (max. 15 digits)</p></td></tr><tr><td><code>groupIds</code></td><td><code>number[]</code></td><td>List of group ids of the groups the subscriber belongs to.</td></tr><tr><td><code>subscriberFields</code></td><td><code>dictionary</code>: <code>subscriberFieldIds:string</code> as the keys and <code>data: string</code> corresponding values</td><td><p>A dictionary of key value pairs of additional <a href="assign-custom-subscriber-attributes">custom subscriber attributes</a> for the subscriber.</p><p></p><p><em>Example:</em> </p><pre class="language-curl"><code class="lang-curl">"subscriberFields": {
<strong>    "2000": "January 1st, 2000",
</strong><strong>    "2001": "Custom Field Data"
</strong>}
</code></pre></td></tr></tbody></table>

## Bulk Update Subscribers

> \# Record Limit\
> \
> This endpoint will accept a maximum of \`1,000\` records in a single request.\
> \
> \
> \# Rate Limiting\
> \
> This endpoint overrides the general rate limit with an account rate limit. Requests are limited by the authenticated account instead of the IP address. This endpoint is limited to \`15\` requests every \`15\` seconds

```json
{"openapi":"3.0.0","info":{"title":"Mobile Text Alerts API","version":"8.0.0"},"servers":[{"url":"https://api.mobile-text-alerts.com/v3"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"apiKey"}},"schemas":{"BulkUpdateSubscribers.Response":{"allOf":[{"$ref":"#/components/schemas/IApiResponse"},{"type":"object","properties":{"data":{"type":"object","properties":{"totalRecordCount":{"type":"number"},"updatedRecordCount":{"type":"number"},"errorRecordCount":{"type":"number"},"updatedRecords":{"type":"array","items":{"oneOf":[{"allOf":[{"type":"object","properties":{"record":{"$ref":"#/components/schemas/IPublicNumber"}},"required":["record"],"description":"BulkUpdateSubscribers.BaseResponseDataType"},{"type":"object","properties":{"id":{"type":"number"}},"required":["id"]}],"description":"BulkUpdateSubscribers.ResponseDataWithId"},{"allOf":[{"type":"object","properties":{"record":{"$ref":"#/components/schemas/IPublicNumber"}},"required":["record"],"description":"BulkUpdateSubscribers.BaseResponseDataType"},{"type":"object","properties":{"phoneNumber":{"type":"string"}},"required":["phoneNumber"]}],"description":"BulkUpdateSubscribers.ResponseDataWithPhoneNumber"},{"allOf":[{"type":"object","properties":{"record":{"$ref":"#/components/schemas/IPublicNumber"}},"required":["record"],"description":"BulkUpdateSubscribers.BaseResponseDataType"},{"type":"object","properties":{"email":{"type":"string"}},"required":["email"]}],"description":"BulkUpdateSubscribers.ResponseDataWithEmail"}],"description":"BulkUpdateSubscribers.ResponseRecord"}},"errorRecords":{"type":"array","items":{"oneOf":[{"allOf":[{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"description":"BulkUpdateSubscribers.BaseErrorDataType"},{"type":"object","properties":{"id":{"type":"number"}},"required":["id"]}],"description":"BulkUpdateSubscribers.ErrorDataWithId"},{"allOf":[{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"description":"BulkUpdateSubscribers.BaseErrorDataType"},{"type":"object","properties":{"phoneNumber":{"type":"string"}},"required":["phoneNumber"]}],"description":"BulkUpdateSubscribers.ErrorDataWithPhoneNumber"},{"allOf":[{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"description":"BulkUpdateSubscribers.BaseErrorDataType"},{"type":"object","properties":{"email":{"type":"string"}},"required":["email"]}],"description":"BulkUpdateSubscribers.ErrorDataWithEmail"}],"description":"BulkUpdateSubscribers.ErrorRecord"}}},"required":["totalRecordCount","updatedRecordCount","errorRecordCount","updatedRecords","errorRecords"]}},"required":["data"]}]},"IApiResponse":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"string"},"message":{"type":"string"},"data":{}},"required":[]},"IPublicNumber":{"type":"object","properties":{"id":{"type":"number"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"number":{"type":"number"},"e164Number":{"type":"string"},"date":{"oneOf":[{"format":"date-time","type":"string"},{"type":"string"}]},"countryId":{"type":"number"},"groups":{"type":"array","items":{"$ref":"#/components/schemas/IPublicGroupName"}},"subscriberFieldData":{"type":"array","items":{"$ref":"#/components/schemas/IPublicSubscriberFieldDatum"}},"signupMethod":{"type":"number","nullable":true},"longNumber":{"type":"number"},"carrierId":{"type":"number"}},"required":["id","firstName","lastName","email","number","date","countryId","groups","subscriberFieldData","signupMethod","longNumber","carrierId"]},"IPublicGroupName":{"type":"object","properties":{"id":{"type":"number"},"name":{"type":"string"},"addedToGroupAt":{"oneOf":[{"format":"date-time","type":"string"},{"type":"string"}]}},"required":["id","name"]},"IPublicSubscriberFieldDatum":{"type":"object","properties":{"id":{"type":"number"},"subscriberFieldId":{"type":"number"},"data":{"type":"string"}},"required":["id","subscriberFieldId","data"]},"BulkUpdateSubscribers.Request":{"type":"array","items":{"oneOf":[{"allOf":[{"type":"object","properties":{"record":{"$ref":"#/components/schemas/UpdateSubscriber.Request"}},"required":["record"],"description":"BulkUpdateSubscribers.BaseRequest"},{"type":"object","properties":{"id":{"type":"number"}},"required":["id"]}],"description":"BulkUpdateSubscribers.RequestWithId"},{"allOf":[{"type":"object","properties":{"record":{"$ref":"#/components/schemas/UpdateSubscriber.Request"}},"required":["record"],"description":"BulkUpdateSubscribers.BaseRequest"},{"type":"object","properties":{"phoneNumber":{"type":"string"}},"required":["phoneNumber"]}],"description":"BulkUpdateSubscribers.RequestWithPhoneNumber"},{"allOf":[{"type":"object","properties":{"record":{"$ref":"#/components/schemas/UpdateSubscriber.Request"}},"required":["record"],"description":"BulkUpdateSubscribers.BaseRequest"},{"type":"object","properties":{"email":{"type":"string"}},"required":["email"]}],"description":"BulkUpdateSubscribers.RequestWithEmail"}],"description":"BulkUpdateSubscribers.RequestRecord"}},"UpdateSubscriber.Request":{"$ref":"#/components/schemas/CreateSubscriber.Request"},"CreateSubscriber.Request":{"$ref":"#/components/schemas/INewNumber"},"INewNumber":{"type":"object","properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"number":{"oneOf":[{"type":"number"},{"type":"string"}]},"e164Number":{"type":"string"},"groupIds":{"type":"array","items":{"type":"number"}},"subscriberFields":{"type":"object","additionalProperties":{"type":"string"}},"employeeNumber":{"type":"string"},"welcomeMessage":{"type":"string"}},"required":[]}},"responses":{"BadRequestError":{"description":"BadRequestError","content":{"application/json":{"schema":{"type":"object","properties":{"httpCode":{"type":"number","enum":[400]},"message":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"type":{"type":"string","enum":["bad_request_error"]},"name":{"type":"string","enum":["MTABadRequestError"]},"requestId":{"type":"string","format":"uuid"}}}}}},"UnauthorizedError":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"type":"object","properties":{"httpCode":{"type":"number","enum":[401]},"message":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"type":{"type":"string","enum":["unauthorized_error"]},"name":{"type":"string","enum":["MTAUnauthorizedError"]},"requestId":{"type":"string","format":"uuid"}}}}}},"ForbiddenError":{"description":"ForbiddenError","content":{"application/json":{"schema":{"type":"object","properties":{"httpCode":{"type":"number","enum":[403]},"message":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"type":{"type":"string","enum":["forbidden_error"]},"name":{"type":"string","enum":["MTAForbiddenError"]},"requestId":{"type":"string","format":"uuid"},"reason":{}}}}}},"RateLimitError":{"description":"RateLimitError","content":{"application/json":{"schema":{"type":"object","properties":{"httpCode":{"type":"number","enum":[429]},"message":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"type":{"type":"string","enum":["rate_limit_error"]},"name":{"type":"string","enum":["MTARateLimitError"]},"requestId":{"type":"string","format":"uuid"}}}}}},"InternalServerError":{"description":"InternalServerError","content":{"application/json":{"schema":{"type":"object","properties":{"httpCode":{"type":"number","enum":[500]},"message":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"type":{"type":"string","enum":["internal_server_error"]},"name":{"type":"string","enum":["MTAInternalServerError"]},"requestId":{"type":"string","format":"uuid"}}}}}}}},"paths":{"/subscribers/bulk":{"patch":{"tags":["Subscribers"],"summary":"Bulk Update Subscribers","description":"# Record Limit\n\nThis endpoint will accept a maximum of `1,000` records in a single request.\n\n\n# Rate Limiting\n\nThis endpoint overrides the general rate limit with an account rate limit. Requests are limited by the authenticated account instead of the IP address. This endpoint is limited to `15` requests every `15` seconds","operationId":"subscribers_bulk_update_subscribers","responses":{"200":{"description":"Success","headers":{"RateLimit-Limit":{"description":"The maximum number of requests that the consumer is permitted to make per window","schema":{"type":"integer"}},"RateLimit-Remaining":{"description":"The number of requests remaining in the current rate limit window","schema":{"type":"integer"}},"RateLimit-Reset":{"description":"The remaining window before the rate limit resets in milliseconds","schema":{"type":"integer"}},"Retry-After":{"description":"The number of seconds to wait before retrying the request","schema":{"type":"integer"}},"X-RateLimit-Limit":{"description":"The maximum number of requests that the consumer is permitted to make per window","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"The number of requests remaining in the current rate limit window","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"The remaining window before the rate limit resets in milliseconds","schema":{"type":"integer"}},"X-Request-ID":{"description":"A unique identifier for the request","schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkUpdateSubscribers.Response"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"},"429":{"$ref":"#/components/responses/RateLimitError"},"500":{"$ref":"#/components/responses/InternalServerError"}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkUpdateSubscribers.Request"}}},"required":true}}}}}
```
