get

Retrieve a list of all credentials, or permissions for a specific credential.

Parameter Required Requirements Description
api_user Yes alphanumeric The primary account holder’s user ID creating the new account
api_key Yes alphanumeric The primary account holder’s password
username No alphanumeric If a username is supplied, the API returns the JSON permissions for that user

Call

GET https://api.sendgrid.com/api/credentials/get.json?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
18
19
20
21
22
23
24
//success
[
  {
    "id": 4,
    "name": "johnsmith",
    "permissions": {
      "email": 0,
      "api": 1
    }
  },
  {
    "id": 15,
    "name": "joewrigley",
    "permissions": {
      "web": 1,
      "api": 0
    }
  }
]

//error
{
  "error": "error reason"
}

Call

GET https://api.sendgrid.com/api/credentials/get.xml?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
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?xml version="1.0" encoding="ISO-8859-1"?>

<!-- success -->
<credentials>
   <credential>
      <created_at>2013-01-21 16:52:01</created_at>
      <permissions>
         {"web": 1, "api": 0, "email": 0}
         <permissions>
            <id>13243</id>
            <name>John Smith</name>
            <updated_at>2013-01-21 16:52:01</updated_at>
         </permissions>
         <credential>
            <created_at>2013-01-21 16:52:01</created_at>
            <permissions>
               {"web": 1, "api": 1, "email": 0}
               <permissions>
                  <id>13243</id>
                  <name>Joe Wrigley</name>
                  <updated_at>2013-01-21 16:52:01</updated_at>
               </permissions>
            </permissions>
         </credential>
      </permissions>
   </credential>
</credentials>

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

Add

This API call allows user to add a new set of credentials to their account.

Parameter Required Requirements Description
api_user Yes alphanumeric The primary account holder’s user ID creating the new account
api_key Yes alphanumeric The primary account holder’s password
username Yes alphanumeric Enter a username for the new account
password Yes alphanumeric Enter a password for the new account
permissions No JSON array of bits

Credentials are specified using a JSON object. There are three key names: email for access to SMTP, api for programmatic access, and web for administration. The values for each are a bit, 0 for off or 1 for on.

The following example allows the specified username/password to log into the dashboard, but not send email or have access to any of the APIs:

{"email": 0, "web": 1, "api": 0}

Call

POST https://api.sendgrid.com/api/credentials/add.json
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&username=name&password=password&permissions={"email":

Response

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

//error
{
  "error": "error reason"
}

Call

POST https://api.sendgrid.com/api/credentials/add.xml
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&username=name&password=password&permissions={"email":

Response

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

<!-- success -->
<result>
   <count>4</count>
</result>

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

Edit

Parameter Required Requirements Description
api_user Yes alphanumeric The primary account holder’s user ID creating the new account
api_key Yes alphanumeric The primary account holder’s password
username Yes alphanumeric The existing credentials to edit
password No alphanumeric Optionally update the password
permissions No JSON array of bits

Credentials are specified using a JSON object. There are three key names: email for access to SMTP, api for programmatic access, and web for administration. The values for each are a bit, 0 for off or 1 for on.

The following example allows the specified username/password to log into the dashboard, but not send email or have access to any of the APIs:

{"email": 0, "web": 1, "api": 0}

If you do not specify any additional parameters (i.e., email, web, api), then no permissions will be changed. This behavior allows you to change passwords without having to lookup the current applied permissions.

Call

POST https://api.sendgrid.com/api/credentials/edit.json
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&username=name&password=password&permissions={"email":

Response

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

//error
{
  "error": "error reason"
}

Call

POST https://api.sendgrid.com/api/credentials/edit.xml
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&username=name&password=password&permissions={"email":

Response

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

<!-- success -->
<result>
   <count>4</count>
</result>

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

Delete

Parameter Required Requirements Description
api_user Yes alphanumeric The primary account holder’s user ID creating the new account
api_key Yes alphanumeric The primary account holder’s password
username Yes alphanumeric The credential to remove

Call

POST https://api.sendgrid.com/api/credentials/remove.json
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&username=name

Response

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

//error
{
  "error": "error reason"
}

Call

POST https://api.sendgrid.com/api/credentials/remove.xml
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&username=name

Response

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

<!-- success -->
<result>
   <count>4</count>
</result>

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