Retrieve invoices/usages from customers.

Parameter Required Description
task Yes Must be set to usage.
number Yes Must be the invoice number you received from SendGrid.
Parameter Value Requirements Description

Call

POST https://api.sendgrid.com/apiv2/reseller.billing.json
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&number=2010010001&task=usag

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
33
34
35
36
37
38
39
40
41
42
43
44
45
{
  "number": "2010010001",
  "invoices": [
    {
      "number": "201001000100",
      "credits": 123456,
      "date_invoiced": "2010-09-0100:00:00",
      "status": "Unpaid",
      "amount": 1001,
      "overage": 6.95,
      "type": "Recurring Bill",
      "prorated": 0,
      "start_date": "2010-08-01",
      "end_date": "2010-08-31",
      "username": "user4@example.com",
      "package": "Example Package",
      "additional_charges": 0,
      "final_amount": 1007.95
    },
    {
      "number": "201001000200",
      "credits": "1333",
      "date_invoiced": "2010-09-05 00:00:00",
      "status": "Unpaid",
      "amount": 13.95,
      "overage": 0,
      "type": "Recurring Bill",
      "prorated": 0,
      "start_date": "2010-08-01",
      "end_date": "2010-08-31",
      "username": "user5@example.com",
      "package": "Example Package",
      "additional_charges": 0,
      "final_amount": 13.95
    }
  ]
}

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

Call

POST https://api.sendgrid.com/apiv2/reseller.billing.xml
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&number=2010010001&task=usag

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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?xml version="1.0" encoding="ISO-8859-1"?>

<usage>
   <number>2010010001</number>
   <invoices>
      <invoice>
         <number>201001000100</number>
         <credits>123456</credits>
         <date_invoiced>2010-09-01 00:00:00</date_invoiced>
         <status>Unpaid</status>
         <amount>1001</amount>
         <overage>6.95</overage>
         <type>Recurring Bill</type>
         <prorated>0</prorated>
         <start_date>2010-08-01</start_date>
         <end_date>2010-08-31</end_date>
         <username>user4@example.com</username>
         <package>Example Package</package>
         <additional_charges>0</additional_charges>
         <final_amount>1007.95</final_amount>
      </invoice>
      <invoice>
         <number>201001000200</number>
         <credits>1333</credits>
         <date_invoiced>2010-09-05 00:00:00</date_invoiced>
         <status>Unpaid</status>
         <amount>13.95</amount>
         <overage>0</overage>
         <type>Recurring Bill</type>
         <prorated>0</prorated>
         <start_date>2010-08-01</start_date>
         <end_date>2010-08-31</end_date>
         <username>user5@example.com</username>
         <package>Example Package</package>
         <additional_charges>0</additional_charges>
         <final_amount>13.95</final_amount>
      </invoice>
   </invoices>
</usage>

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

<result>
   <message>error</message>
   <errors>
      ...
      <error>... error messages ...</error>
      ...
   </errors>
</result>