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

# Create Suppression Group

> Create a new suppression group for managing email opt-outs by category using the AutoSend API.

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://api.autosend.com/v1/suppression-groups' \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "name": "Marketing Unsubscribes",
      "description": "Users who opted out of marketing",
      "isActive": true
    }'
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://api.autosend.com/v1/suppression-groups",
      headers={
          "Authorization": "Bearer <token>",
          "Content-Type": "application/json",
      },
      json={
          "name": "Marketing Unsubscribes",
          "description": "Users who opted out of marketing",
          "isActive": true,
      },
  )
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://api.autosend.com/v1/suppression-groups",
    {
      method: "POST",
      headers: {
        Authorization: "Bearer <token>",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        name: "Marketing Unsubscribes",
        description: "Users who opted out of marketing",
        isActive: true,
      }),
    }
  );
  const data = await response.json();
  console.log(data);
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, "https://api.autosend.com/v1/suppression-groups");
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
      "name" => "Marketing Unsubscribes",
      "description" => "Users who opted out of marketing",
      "isActive" => true,
  ]));
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
      "Authorization: Bearer <token>",
      "Content-Type: application/json",
  ]);
  $response = curl_exec($ch);
  curl_close($ch);
  echo $response;
  ```

  ```go Go theme={null}
  package main

  import (
      "bytes"
      "encoding/json"
      "fmt"
      "io"
      "net/http"
  )

  func main() {
      payload, _ := json.Marshal(map[string]interface{}{
          "name":        "Marketing Unsubscribes",
          "description": "Users who opted out of marketing",
          "isActive":      true,
      })

      req, _ := http.NewRequest("POST", "https://api.autosend.com/v1/suppression-groups", bytes.NewBuffer(payload))
      req.Header.Set("Authorization", "Bearer <token>")
      req.Header.Set("Content-Type", "application/json")

      client := &http.Client{}
      resp, _ := client.Do(req)
      defer resp.Body.Close()

      body, _ := io.ReadAll(resp.Body)
      fmt.Println(string(body))
  }
  ```

  ```java Java theme={null}
  import java.net.URI;
  import java.net.http.*;

  public class Main {
      public static void main(String[] args) throws Exception {
          String body = """
              {
                "name": "Marketing Unsubscribes",
                "description": "Users who opted out of marketing",
                "isActive": true
              }
              """;

          HttpRequest request = HttpRequest.newBuilder()
              .uri(URI.create("https://api.autosend.com/v1/suppression-groups"))
              .header("Authorization", "Bearer <token>")
              .header("Content-Type", "application/json")
              .POST(HttpRequest.BodyPublishers.ofString(body))
              .build();

          HttpResponse<String> response = HttpClient.newHttpClient()
              .send(request, HttpResponse.BodyHandlers.ofString());
          System.out.println(response.body());
      }
  }
  ```

  ```ruby Ruby theme={null}
  require "net/http"
  require "uri"
  require "json"

  uri = URI("https://api.autosend.com/v1/suppression-groups")
  req = Net::HTTP::Post.new(uri)
  req["Authorization"] = "Bearer <token>"
  req["Content-Type"] = "application/json"
  req.body = {
    name: "Marketing Unsubscribes",
    description: "Users who opted out of marketing",
    isActive: true,
  }.to_json

  response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
  puts response.body
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "id": "AB12C3",
      "name": "Marketing Unsubscribes",
      "description": "Users who opted out of marketing",
      "isActive": true,
      "isGlobal": false
    }
  }
  ```
</ResponseExample>

### Authorizations

<ParamField path="Authorizations" type="string | header" required>
  Bearer authentication header of the form Bearer `<token>`, where `<token>` is your auth token.
</ParamField>

#### Body

<ParamField body="name" type="string" required>
  The display name of the suppression group. Must be between 1 and 200 characters.
</ParamField>

<ParamField body="description" type="string">
  An optional human-readable description of the suppression group.
</ParamField>

<ParamField body="isActive" type="boolean">
  Whether the suppression group is active. Defaults to `true` if not specified.
</ParamField>


## OpenAPI

````yaml POST /suppression-groups
openapi: 3.1.0
info:
  title: Suppression Groups API
  version: 1.0.0
  description: >-
    Manage suppression groups and suppression entries. Suppression groups let
    you categorize unsubscribes, bounces, and spam complaints so that you can
    control which emails are sent to which contacts.
servers:
  - url: https://api.autosend.com/v1
    description: Production
security:
  - bearerAuth: []
paths:
  /suppression-groups:
    post:
      summary: Create Suppression Group
      description: Creates a new suppression group.
      operationId: createSuppressionGroup
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 200
                  example: Marketing Unsubscribes
                description:
                  type: string
                  example: Users who opted out of marketing
                isActive:
                  type: boolean
                  example: true
      responses:
        '200':
          description: The created suppression group.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: '#/components/schemas/SuppressionGroup'
components:
  schemas:
    SuppressionGroup:
      type: object
      properties:
        id:
          type: string
          example: AB12C3
        name:
          type: string
          example: Marketing Unsubscribes
        description:
          type: string
          example: Users who opted out of marketing
        isGlobal:
          type: boolean
          example: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer authentication header of the form `Bearer <token>`, where
        `<token>` is your auth token.

````