This module allows you to create and manage categories within your Marketing Emails.

create

Create a new Category.

Parameter Required Requirements Description.
category Yes None The name that will be used for the Category being created.

Call

POST https://api.sendgrid.com/api/newsletter/category/create.json
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&category=CATEGORY

Response

1
2
3
4
5
6
7
8
9
10
11
12
//success
{
  "message": "success"
}

//error
{
  "message": "error",
  "errors": [
    "...error messages..."
  ]
}

Call

POST https://api.sendgrid.com/api/newsletter/category/create.xml
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&category=CATEGORY

Response

1
2
3
4
5
6
7
8
9
10
11
12
<?xml version="1.0" encoding="ISO-8859-1"?>

<result>
   <message>success</message>
</result>

<!-- error -->
<?xml version="1.0" encoding="ISO-8859-1"?>

<result>
   <message>error: reason</message>
</result>

add

Assign a Category to an existing Marketing Email.

Parameter Required Requirements Description
category Yes Must be an existing Category. The Category that will be added to the marketing email.
name Yes Must be an existing Marketing Email The Marketing Email to which the categories will be added.

Call

POST https://api.sendgrid.com/api/newsletter/category/add.json
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&category=CATEGORY&name=NEWSLETTER

Response

1
2
3
4
5
6
7
8
9
10
11
12
//success
{
  "message": "success"
}

//error
{
  "message": "error",
  "errors": [
    "...error messages..."
  ]
}

Call

POST https://api.sendgrid.com/api/newsletter/category/add.xml
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&category=CATEGORY&name=NEWSLETTER

Response

1
2
3
4
5
6
7
8
9
10
11
12
<?xml version="1.0" encoding="ISO-8859-1"?>

<result>
   <message>success</message>
</result>

<!-- error -->
<?xml version="1.0" encoding="ISO-8859-1"?>

<result>
   <message>error: reason</message>
</result>

remove

Remove specific categories, or all categories from a Marketing Email.\

Parameter Required Requirements Description
name Yes Must be an existing Marketing Email The Marketing Email that will have Category(ies) deleted from it.
category No Must be an existing category currently added to the Marketing Email Remove the Category with this name. If the category is not specified. all categories will be deleted from the Marketing Email.

Call

POST https://api.sendgrid.com/api/newsletter/category/remove.json
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&category=CATEGORY&name=NEWSLETTER

Response

1
2
3
4
5
6
7
8
9
10
11
12
//success
{
  "message": "success"
}

//error
{
  "message": "error",
  "errors": [
    "...error messages..."
  ]
}

Call

POST https://api.sendgrid.com/api/newsletter/category/remove.xml
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&category=CATEGORY&name=NEWSLETTER

Response

1
2
3
4
5
6
7
8
9
10
11
12
<?xml version="1.0" encoding="ISO-8859-1"?>

<result>
   <message>success</message>
</result>

<!-- error -->
<?xml version="1.0" encoding="ISO-8859-1"?>

<result>
   <message>error: reason</message>
</result>

list

List all categories.

Parameter Required Requirements Description
category No Must be an existing Category Search to see if a specific Category exists rather than a list of all Categories.

Call

POST https://api.sendgrid.com/api/newsletter/category/list.json
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//success
[
  {
    "category": "CATEGORY"
  },
  {
    "category": "CATEGORY2"
  }
]

//error
{
  "message": "error",
  "errors": [
    "...error messages..."
  ]
}

Call

POST https://api.sendgrid.com/api/newsletter/category/list.xml
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?xml version="1.0" encoding="ISO-8859-1"?>

<categories>
   <category>
      <category>CATEGORY</category>
   </category>
   <category>
      <category>CATEGORY2</category>
   </category>
</categories>

<!-- error -->
<?xml version="1.0" encoding="ISO-8859-1"?>

<result>
   <message>error: reason</message>
</result>