Create and send an invoice
curl --request POST \
--url https://api.example.com/api/v1/invoices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer": {
"email": "john@example.com",
"first_name": "John",
"last_name": "Doe",
"phone": "08012345678"
},
"line_items": [
{
"description": "Consulting services",
"quantity": 2,
"unit_price": 500
}
],
"currency": "USD",
"tax_rate": 7.5,
"discount_amount": 50,
"due_date": "2026-07-01T00:00:00Z",
"notes": "Thank you for your business.",
"metadata": {
"order_ref": "ord_123"
}
}
'import requests
url = "https://api.example.com/api/v1/invoices"
payload = {
"customer": {
"email": "john@example.com",
"first_name": "John",
"last_name": "Doe",
"phone": "08012345678"
},
"line_items": [
{
"description": "Consulting services",
"quantity": 2,
"unit_price": 500
}
],
"currency": "USD",
"tax_rate": 7.5,
"discount_amount": 50,
"due_date": "2026-07-01T00:00:00Z",
"notes": "Thank you for your business.",
"metadata": { "order_ref": "ord_123" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer: {
email: 'john@example.com',
first_name: 'John',
last_name: 'Doe',
phone: '08012345678'
},
line_items: [{description: 'Consulting services', quantity: 2, unit_price: 500}],
currency: 'USD',
tax_rate: 7.5,
discount_amount: 50,
due_date: '2026-07-01T00:00:00Z',
notes: 'Thank you for your business.',
metadata: {order_ref: 'ord_123'}
})
};
fetch('https://api.example.com/api/v1/invoices', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/invoices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customer' => [
'email' => 'john@example.com',
'first_name' => 'John',
'last_name' => 'Doe',
'phone' => '08012345678'
],
'line_items' => [
[
'description' => 'Consulting services',
'quantity' => 2,
'unit_price' => 500
]
],
'currency' => 'USD',
'tax_rate' => 7.5,
'discount_amount' => 50,
'due_date' => '2026-07-01T00:00:00Z',
'notes' => 'Thank you for your business.',
'metadata' => [
'order_ref' => 'ord_123'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/invoices"
payload := strings.NewReader("{\n \"customer\": {\n \"email\": \"john@example.com\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"08012345678\"\n },\n \"line_items\": [\n {\n \"description\": \"Consulting services\",\n \"quantity\": 2,\n \"unit_price\": 500\n }\n ],\n \"currency\": \"USD\",\n \"tax_rate\": 7.5,\n \"discount_amount\": 50,\n \"due_date\": \"2026-07-01T00:00:00Z\",\n \"notes\": \"Thank you for your business.\",\n \"metadata\": {\n \"order_ref\": \"ord_123\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/invoices")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customer\": {\n \"email\": \"john@example.com\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"08012345678\"\n },\n \"line_items\": [\n {\n \"description\": \"Consulting services\",\n \"quantity\": 2,\n \"unit_price\": 500\n }\n ],\n \"currency\": \"USD\",\n \"tax_rate\": 7.5,\n \"discount_amount\": 50,\n \"due_date\": \"2026-07-01T00:00:00Z\",\n \"notes\": \"Thank you for your business.\",\n \"metadata\": {\n \"order_ref\": \"ord_123\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/invoices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer\": {\n \"email\": \"john@example.com\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"08012345678\"\n },\n \"line_items\": [\n {\n \"description\": \"Consulting services\",\n \"quantity\": 2,\n \"unit_price\": 500\n }\n ],\n \"currency\": \"USD\",\n \"tax_rate\": 7.5,\n \"discount_amount\": 50,\n \"due_date\": \"2026-07-01T00:00:00Z\",\n \"notes\": \"Thank you for your business.\",\n \"metadata\": {\n \"order_ref\": \"ord_123\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": false,
"status": 400,
"message": "Validation failed.",
"timestamp": "2026-09-17T12:00:00.000Z",
"errors": [
"amount must not be less than 0"
]
}{
"success": false,
"status": 400,
"message": "Validation failed.",
"timestamp": "2026-09-17T12:00:00.000Z",
"errors": [
"amount must not be less than 0"
]
}Invoices
Create and send an invoice
Creates an invoice via CoincircuitMCP and saves it to the database. Returns the invoice including a payment URL to share with your customer.
POST
/
api
/
v1
/
invoices
Create and send an invoice
curl --request POST \
--url https://api.example.com/api/v1/invoices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer": {
"email": "john@example.com",
"first_name": "John",
"last_name": "Doe",
"phone": "08012345678"
},
"line_items": [
{
"description": "Consulting services",
"quantity": 2,
"unit_price": 500
}
],
"currency": "USD",
"tax_rate": 7.5,
"discount_amount": 50,
"due_date": "2026-07-01T00:00:00Z",
"notes": "Thank you for your business.",
"metadata": {
"order_ref": "ord_123"
}
}
'import requests
url = "https://api.example.com/api/v1/invoices"
payload = {
"customer": {
"email": "john@example.com",
"first_name": "John",
"last_name": "Doe",
"phone": "08012345678"
},
"line_items": [
{
"description": "Consulting services",
"quantity": 2,
"unit_price": 500
}
],
"currency": "USD",
"tax_rate": 7.5,
"discount_amount": 50,
"due_date": "2026-07-01T00:00:00Z",
"notes": "Thank you for your business.",
"metadata": { "order_ref": "ord_123" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer: {
email: 'john@example.com',
first_name: 'John',
last_name: 'Doe',
phone: '08012345678'
},
line_items: [{description: 'Consulting services', quantity: 2, unit_price: 500}],
currency: 'USD',
tax_rate: 7.5,
discount_amount: 50,
due_date: '2026-07-01T00:00:00Z',
notes: 'Thank you for your business.',
metadata: {order_ref: 'ord_123'}
})
};
fetch('https://api.example.com/api/v1/invoices', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/invoices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customer' => [
'email' => 'john@example.com',
'first_name' => 'John',
'last_name' => 'Doe',
'phone' => '08012345678'
],
'line_items' => [
[
'description' => 'Consulting services',
'quantity' => 2,
'unit_price' => 500
]
],
'currency' => 'USD',
'tax_rate' => 7.5,
'discount_amount' => 50,
'due_date' => '2026-07-01T00:00:00Z',
'notes' => 'Thank you for your business.',
'metadata' => [
'order_ref' => 'ord_123'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/invoices"
payload := strings.NewReader("{\n \"customer\": {\n \"email\": \"john@example.com\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"08012345678\"\n },\n \"line_items\": [\n {\n \"description\": \"Consulting services\",\n \"quantity\": 2,\n \"unit_price\": 500\n }\n ],\n \"currency\": \"USD\",\n \"tax_rate\": 7.5,\n \"discount_amount\": 50,\n \"due_date\": \"2026-07-01T00:00:00Z\",\n \"notes\": \"Thank you for your business.\",\n \"metadata\": {\n \"order_ref\": \"ord_123\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/invoices")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customer\": {\n \"email\": \"john@example.com\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"08012345678\"\n },\n \"line_items\": [\n {\n \"description\": \"Consulting services\",\n \"quantity\": 2,\n \"unit_price\": 500\n }\n ],\n \"currency\": \"USD\",\n \"tax_rate\": 7.5,\n \"discount_amount\": 50,\n \"due_date\": \"2026-07-01T00:00:00Z\",\n \"notes\": \"Thank you for your business.\",\n \"metadata\": {\n \"order_ref\": \"ord_123\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/invoices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer\": {\n \"email\": \"john@example.com\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"08012345678\"\n },\n \"line_items\": [\n {\n \"description\": \"Consulting services\",\n \"quantity\": 2,\n \"unit_price\": 500\n }\n ],\n \"currency\": \"USD\",\n \"tax_rate\": 7.5,\n \"discount_amount\": 50,\n \"due_date\": \"2026-07-01T00:00:00Z\",\n \"notes\": \"Thank you for your business.\",\n \"metadata\": {\n \"order_ref\": \"ord_123\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": false,
"status": 400,
"message": "Validation failed.",
"timestamp": "2026-09-17T12:00:00.000Z",
"errors": [
"amount must not be less than 0"
]
}{
"success": false,
"status": 400,
"message": "Validation failed.",
"timestamp": "2026-09-17T12:00:00.000Z",
"errors": [
"amount must not be less than 0"
]
}Authorizations
API key for /api/v1/* endpoints
Body
application/json
Show child attributes
Show child attributes
Show child attributes
Show child attributes
ISO currency code
Example:
"USD"
Tax rate as a percentage (e.g. 7.5)
Example:
7.5
Flat discount amount
Example:
50
Due date (ISO 8601)
Example:
"2026-07-01T00:00:00Z"
Example:
"Thank you for your business."
Example:
{ "order_ref": "ord_123" }
Response
Invoice created successfully.