Create Credit Note
curl --request POST \
--url http://localhost:8000/documents/{document_id}/credit-note \
--header 'Content-Type: application/json' \
--data '
{
"reason": "<string>",
"lines": [
{
"line_number": 2,
"description": "<string>",
"quantity": 1,
"unit_price": 1,
"subtotal": 1,
"tax_rate_code": "<string>",
"main_code": "<string>",
"aux_code": "<string>",
"discount": "0.00",
"tax_code": "2"
}
],
"taxes": [
{
"tax_code": "<string>",
"tax_rate_code": "<string>",
"taxable_base": 1,
"rate": 0.5,
"tax_amount": 1
}
],
"subtotal": 123,
"total_tax": 123,
"total": 123,
"issue_date": "2023-12-25",
"total_discount": "0.00",
"idempotency_key": "<string>"
}
'import requests
url = "http://localhost:8000/documents/{document_id}/credit-note"
payload = {
"reason": "<string>",
"lines": [
{
"line_number": 2,
"description": "<string>",
"quantity": 1,
"unit_price": 1,
"subtotal": 1,
"tax_rate_code": "<string>",
"main_code": "<string>",
"aux_code": "<string>",
"discount": "0.00",
"tax_code": "2"
}
],
"taxes": [
{
"tax_code": "<string>",
"tax_rate_code": "<string>",
"taxable_base": 1,
"rate": 0.5,
"tax_amount": 1
}
],
"subtotal": 123,
"total_tax": 123,
"total": 123,
"issue_date": "2023-12-25",
"total_discount": "0.00",
"idempotency_key": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
reason: '<string>',
lines: [
{
line_number: 2,
description: '<string>',
quantity: 1,
unit_price: 1,
subtotal: 1,
tax_rate_code: '<string>',
main_code: '<string>',
aux_code: '<string>',
discount: '0.00',
tax_code: '2'
}
],
taxes: [
{
tax_code: '<string>',
tax_rate_code: '<string>',
taxable_base: 1,
rate: 0.5,
tax_amount: 1
}
],
subtotal: 123,
total_tax: 123,
total: 123,
issue_date: '2023-12-25',
total_discount: '0.00',
idempotency_key: '<string>'
})
};
fetch('http://localhost:8000/documents/{document_id}/credit-note', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8000",
CURLOPT_URL => "http://localhost:8000/documents/{document_id}/credit-note",
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([
'reason' => '<string>',
'lines' => [
[
'line_number' => 2,
'description' => '<string>',
'quantity' => 1,
'unit_price' => 1,
'subtotal' => 1,
'tax_rate_code' => '<string>',
'main_code' => '<string>',
'aux_code' => '<string>',
'discount' => '0.00',
'tax_code' => '2'
]
],
'taxes' => [
[
'tax_code' => '<string>',
'tax_rate_code' => '<string>',
'taxable_base' => 1,
'rate' => 0.5,
'tax_amount' => 1
]
],
'subtotal' => 123,
'total_tax' => 123,
'total' => 123,
'issue_date' => '2023-12-25',
'total_discount' => '0.00',
'idempotency_key' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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 := "http://localhost:8000/documents/{document_id}/credit-note"
payload := strings.NewReader("{\n \"reason\": \"<string>\",\n \"lines\": [\n {\n \"line_number\": 2,\n \"description\": \"<string>\",\n \"quantity\": 1,\n \"unit_price\": 1,\n \"subtotal\": 1,\n \"tax_rate_code\": \"<string>\",\n \"main_code\": \"<string>\",\n \"aux_code\": \"<string>\",\n \"discount\": \"0.00\",\n \"tax_code\": \"2\"\n }\n ],\n \"taxes\": [\n {\n \"tax_code\": \"<string>\",\n \"tax_rate_code\": \"<string>\",\n \"taxable_base\": 1,\n \"rate\": 0.5,\n \"tax_amount\": 1\n }\n ],\n \"subtotal\": 123,\n \"total_tax\": 123,\n \"total\": 123,\n \"issue_date\": \"2023-12-25\",\n \"total_discount\": \"0.00\",\n \"idempotency_key\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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("http://localhost:8000/documents/{document_id}/credit-note")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"<string>\",\n \"lines\": [\n {\n \"line_number\": 2,\n \"description\": \"<string>\",\n \"quantity\": 1,\n \"unit_price\": 1,\n \"subtotal\": 1,\n \"tax_rate_code\": \"<string>\",\n \"main_code\": \"<string>\",\n \"aux_code\": \"<string>\",\n \"discount\": \"0.00\",\n \"tax_code\": \"2\"\n }\n ],\n \"taxes\": [\n {\n \"tax_code\": \"<string>\",\n \"tax_rate_code\": \"<string>\",\n \"taxable_base\": 1,\n \"rate\": 0.5,\n \"tax_amount\": 1\n }\n ],\n \"subtotal\": 123,\n \"total_tax\": 123,\n \"total\": 123,\n \"issue_date\": \"2023-12-25\",\n \"total_discount\": \"0.00\",\n \"idempotency_key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8000/documents/{document_id}/credit-note")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"reason\": \"<string>\",\n \"lines\": [\n {\n \"line_number\": 2,\n \"description\": \"<string>\",\n \"quantity\": 1,\n \"unit_price\": 1,\n \"subtotal\": 1,\n \"tax_rate_code\": \"<string>\",\n \"main_code\": \"<string>\",\n \"aux_code\": \"<string>\",\n \"discount\": \"0.00\",\n \"tax_code\": \"2\"\n }\n ],\n \"taxes\": [\n {\n \"tax_code\": \"<string>\",\n \"tax_rate_code\": \"<string>\",\n \"taxable_base\": 1,\n \"rate\": 0.5,\n \"tax_amount\": 1\n }\n ],\n \"subtotal\": 123,\n \"total_tax\": 123,\n \"total\": 123,\n \"issue_date\": \"2023-12-25\",\n \"total_discount\": \"0.00\",\n \"idempotency_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"credit_note_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"original_document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "<string>",
"access_key": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}documents
Create Credit Note
Create a DRAFT credit note from an authorized invoice.
Validates that the original document is AUTHORIZED and its issue_date is within 12 months. Supports idempotency via idempotency_key. Returns 201 with the new credit note id, state, and original_document_id.
POST
/
documents
/
{document_id}
/
credit-note
Create Credit Note
curl --request POST \
--url http://localhost:8000/documents/{document_id}/credit-note \
--header 'Content-Type: application/json' \
--data '
{
"reason": "<string>",
"lines": [
{
"line_number": 2,
"description": "<string>",
"quantity": 1,
"unit_price": 1,
"subtotal": 1,
"tax_rate_code": "<string>",
"main_code": "<string>",
"aux_code": "<string>",
"discount": "0.00",
"tax_code": "2"
}
],
"taxes": [
{
"tax_code": "<string>",
"tax_rate_code": "<string>",
"taxable_base": 1,
"rate": 0.5,
"tax_amount": 1
}
],
"subtotal": 123,
"total_tax": 123,
"total": 123,
"issue_date": "2023-12-25",
"total_discount": "0.00",
"idempotency_key": "<string>"
}
'import requests
url = "http://localhost:8000/documents/{document_id}/credit-note"
payload = {
"reason": "<string>",
"lines": [
{
"line_number": 2,
"description": "<string>",
"quantity": 1,
"unit_price": 1,
"subtotal": 1,
"tax_rate_code": "<string>",
"main_code": "<string>",
"aux_code": "<string>",
"discount": "0.00",
"tax_code": "2"
}
],
"taxes": [
{
"tax_code": "<string>",
"tax_rate_code": "<string>",
"taxable_base": 1,
"rate": 0.5,
"tax_amount": 1
}
],
"subtotal": 123,
"total_tax": 123,
"total": 123,
"issue_date": "2023-12-25",
"total_discount": "0.00",
"idempotency_key": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
reason: '<string>',
lines: [
{
line_number: 2,
description: '<string>',
quantity: 1,
unit_price: 1,
subtotal: 1,
tax_rate_code: '<string>',
main_code: '<string>',
aux_code: '<string>',
discount: '0.00',
tax_code: '2'
}
],
taxes: [
{
tax_code: '<string>',
tax_rate_code: '<string>',
taxable_base: 1,
rate: 0.5,
tax_amount: 1
}
],
subtotal: 123,
total_tax: 123,
total: 123,
issue_date: '2023-12-25',
total_discount: '0.00',
idempotency_key: '<string>'
})
};
fetch('http://localhost:8000/documents/{document_id}/credit-note', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8000",
CURLOPT_URL => "http://localhost:8000/documents/{document_id}/credit-note",
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([
'reason' => '<string>',
'lines' => [
[
'line_number' => 2,
'description' => '<string>',
'quantity' => 1,
'unit_price' => 1,
'subtotal' => 1,
'tax_rate_code' => '<string>',
'main_code' => '<string>',
'aux_code' => '<string>',
'discount' => '0.00',
'tax_code' => '2'
]
],
'taxes' => [
[
'tax_code' => '<string>',
'tax_rate_code' => '<string>',
'taxable_base' => 1,
'rate' => 0.5,
'tax_amount' => 1
]
],
'subtotal' => 123,
'total_tax' => 123,
'total' => 123,
'issue_date' => '2023-12-25',
'total_discount' => '0.00',
'idempotency_key' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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 := "http://localhost:8000/documents/{document_id}/credit-note"
payload := strings.NewReader("{\n \"reason\": \"<string>\",\n \"lines\": [\n {\n \"line_number\": 2,\n \"description\": \"<string>\",\n \"quantity\": 1,\n \"unit_price\": 1,\n \"subtotal\": 1,\n \"tax_rate_code\": \"<string>\",\n \"main_code\": \"<string>\",\n \"aux_code\": \"<string>\",\n \"discount\": \"0.00\",\n \"tax_code\": \"2\"\n }\n ],\n \"taxes\": [\n {\n \"tax_code\": \"<string>\",\n \"tax_rate_code\": \"<string>\",\n \"taxable_base\": 1,\n \"rate\": 0.5,\n \"tax_amount\": 1\n }\n ],\n \"subtotal\": 123,\n \"total_tax\": 123,\n \"total\": 123,\n \"issue_date\": \"2023-12-25\",\n \"total_discount\": \"0.00\",\n \"idempotency_key\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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("http://localhost:8000/documents/{document_id}/credit-note")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"<string>\",\n \"lines\": [\n {\n \"line_number\": 2,\n \"description\": \"<string>\",\n \"quantity\": 1,\n \"unit_price\": 1,\n \"subtotal\": 1,\n \"tax_rate_code\": \"<string>\",\n \"main_code\": \"<string>\",\n \"aux_code\": \"<string>\",\n \"discount\": \"0.00\",\n \"tax_code\": \"2\"\n }\n ],\n \"taxes\": [\n {\n \"tax_code\": \"<string>\",\n \"tax_rate_code\": \"<string>\",\n \"taxable_base\": 1,\n \"rate\": 0.5,\n \"tax_amount\": 1\n }\n ],\n \"subtotal\": 123,\n \"total_tax\": 123,\n \"total\": 123,\n \"issue_date\": \"2023-12-25\",\n \"total_discount\": \"0.00\",\n \"idempotency_key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8000/documents/{document_id}/credit-note")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"reason\": \"<string>\",\n \"lines\": [\n {\n \"line_number\": 2,\n \"description\": \"<string>\",\n \"quantity\": 1,\n \"unit_price\": 1,\n \"subtotal\": 1,\n \"tax_rate_code\": \"<string>\",\n \"main_code\": \"<string>\",\n \"aux_code\": \"<string>\",\n \"discount\": \"0.00\",\n \"tax_code\": \"2\"\n }\n ],\n \"taxes\": [\n {\n \"tax_code\": \"<string>\",\n \"tax_rate_code\": \"<string>\",\n \"taxable_base\": 1,\n \"rate\": 0.5,\n \"tax_amount\": 1\n }\n ],\n \"subtotal\": 123,\n \"total_tax\": 123,\n \"total\": 123,\n \"issue_date\": \"2023-12-25\",\n \"total_discount\": \"0.00\",\n \"idempotency_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"credit_note_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"original_document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "<string>",
"access_key": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Path Parameters
Cookies
Body
application/json
Required string length:
1 - 500Show child attributes
Show child attributes
Show child attributes
Show child attributes
⌘I