Terraform
- Terraform Enterprise
- 1.0.x (latest)
- v202507-1
- v202506-1
- v202505-1
- v202504-1
- v202503-1
- v202502-2
- v202502-1
- v202501-1
- v202411-2
- v202410-1
- v202409-3
- v202409-2
- v202409-1
- v202408-1
- No versions of this document exist before v202408-1. Click below to redirect to the version homepage.
- v202407-1
- v202406-1
- v202405-1
- v202404-2
- v202404-1
- v202402-2
- v202402-1
- v202401-2
- v202401-1
- v202312-1
- v202311-1
- v202310-1
- v202309-1
- v202308-1
- v202307-1
- v202306-1
- v202305-2
- v202305-1
- v202304-1
- v202303-1
- v202302-1
- v202301-2
- v202301-1
- v202212-2
- v202212-1
- v202211-1
- v202210-1
- v202209-2
- v202209-1
- v202208-3
- v202208-2
- v202208-1
- v202207-2
- v202207-1
- v202206-1
Invoices API
Note: The invoices API is only available in HCP Terraform.
Organizations on credit-card-billed plans may view their previous and upcoming invoices.
List Invoices
This endpoint lists the previous invoices for an organization.
It uses a pagination scheme that's somewhat different from our standard pagination. The page size is always 10 items and is not configurable; if there are no more items, meta.continuation will be null. The current page is controlled by the cursor parameter, described below.
GET /organizations/:organization_name/invoices
| Parameter | Description |
|---|---|
:organization_name | The name of the organization you'd like to view invoices for |
:cursor | Optional. The ID of the invoice where the page should start. If omitted, the endpoint will return the first page. |
Sample Request
curl \
--header "Authorization: Bearer $TOKEN" \
--header "Content-Type: application/vnd.api+json" \
https://app.terraform.io/api/v2/organizations/hashicorp/invoices
Sample Response
{
"data": [
{
"id": "in_1I4sraHcjZv6Wm0g7nC34mAi",
"type": "billing-invoices",
"attributes": {
"created-at": "2021-01-01T19:00:38Z",
"external-link": "https://pay.stripe.com/invoice/acct_1Eov7THcjZv6Wm0g/invst_IgFMMfdzAZzMQq8GXyUbrk9lFMqvp9SX/pdf",
"number": "2F8CA1AE-0006",
"paid": true,
"status": "paid",
"total": 21000
}
},
{...}
{
"id": "in_1Hte5nHcjZv6Wm0g2Q8hFctH",
"type": "billing-invoices",
"attributes": {
"created-at": "2020-06-01T19:00:51Z",
"external-link": "https://pay.stripe.com/invoice/acct_1Eov7THcjZv6Wm0g/invst_IUdMM6wl0JfA95tgWGZxpBGXYtJwmBgY/pdf",
"number": "2F8CA1AE-0005",
"paid": true,
"status": "paid",
"total": 21000
}
}
],
"meta": {
"continuation": "in_1IBpkEHcjZv6Wm0gHcgc2uwN"
}
}
Get Next Invoice
This endpoint lists the next month's invoice for an organization.
GET /organizations/:organization_name/invoices/next
| Parameter | Description |
|---|---|
organization_name | The name of the organization |
Sample Request
curl \
--header "Authorization: Bearer $TOKEN" \
--header "Content-Type: application/vnd.api+json" \
https://app.terraform.io/api/v2/organizations/hashicorp/invoices/next
Sample Response
{
"data": {
"id": "in_upcoming_510DEB1F-0002",
"type": "billing-invoices",
"attributes": {
"created-at": "2021-02-01T20:00:00Z",
"external-link": "",
"number": "510DEB1F-0002",
"paid": false,
"status": "draft",
"total": 21000
}
}
}