> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.staple.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.staple.ai/_mcp/server.

# Get Billings

POST https://api.staple.io/v1/billings
Content-Type: application/json

Get your billing information including subscription plan information, next billing date, invoices, payment card information and billing contact details.

Reference: https://docs.staple.ai/api-reference/v1/billings/get-billings

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: v1
  version: 1.0.0
paths:
  /v1/billings:
    post:
      operationId: getBillings
      summary: Get Billings
      description: >-
        Get your billing information including subscription plan information,
        next billing date, invoices, payment card information and billing
        contact details.
      tags:
        - billings
      parameters:
        - name: x-api-key
          in: header
          description: API key issued by Staple.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Billings_getBillings_Response_200'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                invoiceLimit:
                  type: integer
servers:
  - url: https://api.staple.io
    description: https://api.staple.io
components:
  schemas:
    Billings_getBillings_Response_200:
      type: object
      properties: {}
      description: Empty response body
      title: Billings_getBillings_Response_200
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key issued by Staple.
    bearerAuth:
      type: http
      scheme: bearer
      description: JWT obtained from the login endpoint.

```

## Examples

### Get Billings



**Request**

```json
undefined
```

**Response**

```json
{
  "getBilling": {
    "billing": {
      "address": "Duong Quang Ham, Go Vap",
      "city": "HCM",
      "country": "vn",
      "phoneNumber": "0992929292",
      "postCode": "70000"
    },
    "card": {
      "brand": null,
      "exp_month": null,
      "exp_year": null,
      "id": null,
      "last4": null,
      "name": null
    },
    "invoice": {
      "items": [
        {
          "created": "3/6/2020",
          "number": "CAFE6839-0001",
          "total": "0"
        }
      ],
      "next": null,
      "prev": null
    },
    "subscription": {
      "id": "sub_HZs9UoUIPHTXd8",
      "nextBilling": "Aug 3, 2020",
      "plans": [
        {
          "amount": "0",
          "currency": "usd",
          "id": "STAPLE_DEVELOPER_FREE",
          "interval": "month",
          "name": "Developer Free Monthly",
          "subsItem": "si_HZs9ph3VkObBkR",
          "usageType": "metered"
        }
      ],
      "total": "0"
    }
  }
}
```

**SDK Code**

```python Get Billings
import requests

url = "https://api.staple.io/v1/billings"

headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript Get Billings
const url = 'https://api.staple.io/v1/billings';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: undefined
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Get Billings
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.staple.io/v1/billings"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Get Billings
require 'uri'
require 'net/http'

url = URI("https://api.staple.io/v1/billings")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'

response = http.request(request)
puts response.read_body
```

```java Get Billings
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.staple.io/v1/billings")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .asString();
```

```php Get Billings
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.staple.io/v1/billings', [
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Get Billings
using RestSharp;

var client = new RestClient("https://api.staple.io/v1/billings");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
```

```swift Get Billings
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.staple.io/v1/billings")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Billings_getBillings_example



**Request**

```json
{
  "invoiceLimit": 10
}
```

**Response**

```json
{
  "getBilling": {
    "billing": {
      "address": "Duong Quang Ham, Go Vap",
      "city": "HCM",
      "country": "vn",
      "phoneNumber": "0992929292",
      "postCode": "70000"
    },
    "card": {
      "brand": null,
      "exp_month": null,
      "exp_year": null,
      "id": null,
      "last4": null,
      "name": null
    },
    "invoice": {
      "items": [
        {
          "created": "3/6/2020",
          "number": "CAFE6839-0001",
          "total": "0"
        }
      ],
      "next": null,
      "prev": null
    },
    "subscription": {
      "id": "sub_HZs9UoUIPHTXd8",
      "nextBilling": "Aug 3, 2020",
      "plans": [
        {
          "amount": "0",
          "currency": "usd",
          "id": "STAPLE_DEVELOPER_FREE",
          "interval": "month",
          "name": "Developer Free Monthly",
          "subsItem": "si_HZs9ph3VkObBkR",
          "usageType": "metered"
        }
      ],
      "total": "0"
    }
  }
}
```

**SDK Code**

```python Billings_getBillings_example
import requests

url = "https://api.staple.io/v1/billings"

payload = { "invoiceLimit": 10 }
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Billings_getBillings_example
const url = 'https://api.staple.io/v1/billings';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"invoiceLimit":10}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Billings_getBillings_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.staple.io/v1/billings"

	payload := strings.NewReader("{\n  \"invoiceLimit\": 10\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Billings_getBillings_example
require 'uri'
require 'net/http'

url = URI("https://api.staple.io/v1/billings")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"invoiceLimit\": 10\n}"

response = http.request(request)
puts response.read_body
```

```java Billings_getBillings_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.staple.io/v1/billings")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"invoiceLimit\": 10\n}")
  .asString();
```

```php Billings_getBillings_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.staple.io/v1/billings', [
  'body' => '{
  "invoiceLimit": 10
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Billings_getBillings_example
using RestSharp;

var client = new RestClient("https://api.staple.io/v1/billings");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"invoiceLimit\": 10\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Billings_getBillings_example
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["invoiceLimit": 10] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.staple.io/v1/billings")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```