Create an invoice
POST https://api.app.thrivestack.ai/revenue/invoices
Authentication
Pass your API key in the x-api-key header. Your key must have the Revenue APIs scope enabled.
x-api-key: <Your API Key with Revenue APIs Scope>
Request body
Field Type Required Description
invoice_idstring Yes Your unique identifier for this invoice.
customer_idstring Yes Customer ID in your billing system.
group_idstring Yes Group ID from product telemetry (links billing to product events).
issue_datestring Yes ISO 8601 timestamp when the invoice was issued.
amountnumber Yes Total invoice amount (e.g., 299.99).
currencystring No ISO 4217 currency code: "USD", "EUR", "GBP". Default: "USD".
due_datestring No ISO 8601 timestamp when payment is due.
Example
cURL
JavaScript
Go
curl -X POST https://api.app.thrivestack.ai/revenue/invoices \
-H "x-api-key: <Your API Key with Revenue APIs Scope>" \
-H "Content-Type: application/json" \
-d '{
"invoice_id": "inv_123",
"customer_id": "cust_123",
"group_id": "group_123",
"issue_date": "2024-01-15T00:00:00Z",
"amount": 299.99,
"currency": "USD",
"due_date": "2024-02-15T00:00:00Z"
}'
const response = await fetch(
'https://api.app.thrivestack.ai/revenue/invoices',
{
method: 'POST',
headers: {
'x-api-key': '<Your API Key with Revenue APIs Scope>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
invoice_id: 'inv_123',
customer_id: 'cust_123',
group_id: 'group_123',
issue_date: '2024-01-15T00:00:00Z',
amount: 299.99,
currency: 'USD',
due_date: '2024-02-15T00:00:00Z'
})
}
);
const data = await response.json();
console.log(data);
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
payload := map[string]interface{}{
"invoice_id": "inv_123",
"customer_id": "cust_123",
"group_id": "group_123",
"issue_date": "2024-01-15T00:00:00Z",
"amount": 299.99,
"currency": "USD",
"due_date": "2024-02-15T00:00:00Z",
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST",
"https://api.app.thrivestack.ai/revenue/invoices",
bytes.NewBuffer(body))
req.Header.Set("x-api-key", "<Your API Key with Revenue APIs Scope>")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer resp.Body.Close()
result, _ := io.ReadAll(resp.Body)
fmt.Println(string(result))
}
Response
{
"success": true,
"invoice_id": "inv_123"
}
Update an invoice
PUT https://api.app.thrivestack.ai/revenue/invoices
Request body
Field Type Required Description
invoice_idstring Yes ID of the invoice to update.
issue_datestring No Updated ISO 8601 issue date.
amountnumber No Updated invoice amount.
currencystring No ISO 4217 currency code. Default: "USD".
due_datestring No Updated ISO 8601 due date.
Example
cURL
JavaScript
Go
curl -X PUT https://api.app.thrivestack.ai/revenue/invoices \
-H "x-api-key: <Your API Key with Revenue APIs Scope>" \
-H "Content-Type: application/json" \
-d '{
"invoice_id": "inv_123",
"issue_date": "2024-01-15T00:00:00Z",
"amount": 349.99,
"currency": "USD",
"due_date": "2024-02-15T00:00:00Z"
}'
const response = await fetch(
'https://api.app.thrivestack.ai/revenue/invoices',
{
method: 'PUT',
headers: {
'x-api-key': '<Your API Key with Revenue APIs Scope>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
invoice_id: 'inv_123',
issue_date: '2024-01-15T00:00:00Z',
amount: 349.99,
currency: 'USD',
due_date: '2024-02-15T00:00:00Z'
})
}
);
const data = await response.json();
console.log(data);
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
payload := map[string]interface{}{
"invoice_id": "inv_123",
"issue_date": "2024-01-15T00:00:00Z",
"amount": 349.99,
"currency": "USD",
"due_date": "2024-02-15T00:00:00Z",
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("PUT",
"https://api.app.thrivestack.ai/revenue/invoices",
bytes.NewBuffer(body))
req.Header.Set("x-api-key", "<Your API Key with Revenue APIs Scope>")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer resp.Body.Close()
result, _ := io.ReadAll(resp.Body)
fmt.Println(string(result))
}
Response
{
"success": true,
"invoice_id": "inv_123"
}
Delete an invoice
DELETE https://api.app.thrivestack.ai/revenue/invoices
Request body
Field Type Required Description
invoice_idstring Yes ID of the invoice to delete.
Example
cURL
JavaScript
Go
curl -X DELETE https://api.app.thrivestack.ai/revenue/invoices \
-H "x-api-key: <Your API Key with Revenue APIs Scope>" \
-H "Content-Type: application/json" \
-d '{
"invoice_id": "inv_123"
}'
const response = await fetch(
'https://api.app.thrivestack.ai/revenue/invoices',
{
method: 'DELETE',
headers: {
'x-api-key': '<Your API Key with Revenue APIs Scope>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
invoice_id: 'inv_123'
})
}
);
const data = await response.json();
console.log(data);
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
payload := map[string]string{
"invoice_id": "inv_123",
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("DELETE",
"https://api.app.thrivestack.ai/revenue/invoices",
bytes.NewBuffer(body))
req.Header.Set("x-api-key", "<Your API Key with Revenue APIs Scope>")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer resp.Body.Close()
result, _ := io.ReadAll(resp.Body)
fmt.Println(string(result))
}
Response
{
"success": true,
"invoice_id": "inv_123"
}
Error codes
Status Meaning
400Bad Request — invalid JSON or missing required fields
401Unauthorized — invalid or missing API key, or key lacks Revenue APIs scope
404Not Found — invoice ID does not exist
429Rate Limit Exceeded
500Server Error — try again later