# Groups Bulk Add/Delete Subscribers

## Bulk Add Subscribers to Group

The <mark style="color:orange;">`POST`</mark> [`groups/{groupId}/subscribers/bulk-create`](#post-groups-groupid-subscribers-bulk-create) endpoint can be used to add up to 1,000 subscribers to a single group in a single request.&#x20;

When adding subscribers to a group you will need the `subscriberId`  of each of the subscribers to add and the `groupId` of the group that these subscribers will be added to. The `subscriberIds` parameter in the body of the request accepts an array of `subscriberId` values, while the `groupId` is specified as a path parameter.&#x20;

#### Example Request

In the below example we are adding `subscriberId` :`108767117` and `108767118`  to `groupId`: `187561` .

```json
curl -L \
  --request POST \
  --url 'https://api.mobile-text-alerts.com/v3/groups/187561/subscribers/bulk-create' \
  --header 'Authorization: Bearer 3098eebf-7661-5858-890e-65cd054a0b03' \
  --header 'Content-Type: application/json' \
  --data '{
    "subscriberIds": [
      108767117,
      108767118
    ]
  }'
```

**Successful response:**  `{"message":"Added 2 subscribers to group 187561."`

## Bulk Add Subscribers To Group

> \# 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 \`5\` 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":{"BulkCreateGroupMembers.Response":{"$ref":"#/components/schemas/IApiResponse"},"IApiResponse":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"string"},"message":{"type":"string"},"data":{}},"required":[]},"BulkCreateGroupMembers.Request":{"type":"object","properties":{"subscriberIds":{"type":"array","items":{"type":"number"}}},"required":["subscriberIds"]}},"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":{"/groups/{groupId}/subscribers/bulk-create":{"post":{"tags":["Groups"],"summary":"Bulk Add Subscribers To Group","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 `5` requests every `15` seconds","operationId":"groups_bulk_create_group_members","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/BulkCreateGroupMembers.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"}},"parameters":[{"name":"groupId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkCreateGroupMembers.Request"}}},"required":true}}}}}
```

## Bulk Remove Subscribers from Group

The <mark style="color:orange;">`POST`</mark> [`groups/{groupId}/subscribers/bulk-delete`](#post-groups-groupid-subscribers-bulk-delete) endpoint can be used to remove up to 1,000 subscribers from a single group in a single request.&#x20;

When removing subscribers from a group you will need the `subscriberId`  of each of the subscribers to be removed and the `groupId`  of the group that these subscribers will be deleted from. The `subscriberIds` parameter in the body of the request accepts an array of `subscriberId` values, while the `groupId` is specified as a path parameter.&#x20;

#### Example Request

In the below example we are removing `subscriberId` :`108767117` and `108767118`  from `groupId`: `187561` .

```json
curl -L \
  --request POST \
  --url 'https://api.mobile-text-alerts.com/v3/groups/{groupId}/subscribers/bulk-delete' \
  --header 'Authorization: Bearer 3098eebf-7661-5858-890e-65cd054a0b03' \
  --header 'Content-Type: application/json' \
  --data '{
    "subscriberIds": [
      108767117,
      108767118
    ]
  }'
```

**Successful response:** `{"message": "Removed 2 subscribers from group 187561."}`

## Bulk Remove Subscribers from Group

> \# 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 \`5\` 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":{"BulkDeleteGroupMembers.Response":{"$ref":"#/components/schemas/IApiResponse"},"IApiResponse":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"type":"string"},"message":{"type":"string"},"data":{}},"required":[]},"BulkCreateGroupMembers.Request":{"type":"object","properties":{"subscriberIds":{"type":"array","items":{"type":"number"}}},"required":["subscriberIds"]}},"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":{"/groups/{groupId}/subscribers/bulk-delete":{"post":{"tags":["Groups"],"summary":"Bulk Remove Subscribers from Group","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 `5` requests every `15` seconds","operationId":"groups_bulk_delete_group_members","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/BulkDeleteGroupMembers.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"}},"parameters":[{"name":"groupId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkCreateGroupMembers.Request"}}},"required":true}}}}}
```
