curl --request POST \
--url http://localhost:8000/documents/drafts \
--header 'Content-Type: application/json' \
--data '
{
"issuer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"establishment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"emission_point_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"issue_date": "2023-12-25",
"subtotal": 1,
"total_tax": 1,
"total": 1,
"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
}
],
"numeric_code": "<string>",
"total_discount": "0.00",
"buyer_id_type": "<string>",
"buyer_id": "<string>",
"buyer_name": "<string>",
"buyer_email": "<string>",
"buyer_address": "<string>",
"modified_document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"modified_document_type": "<string>",
"modified_document_number": "<string>",
"modified_document_issue_date": "2023-12-25",
"reason": "<string>",
"idempotency_key": "<string>",
"payments": [
{
"line_number": 2,
"payment_method_code": "<string>",
"total": 1,
"term": 1,
"time_unit": "<string>"
}
]
}
'import requests
url = "http://localhost:8000/documents/drafts"
payload = {
"issuer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"establishment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"emission_point_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"issue_date": "2023-12-25",
"subtotal": 1,
"total_tax": 1,
"total": 1,
"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
}
],
"numeric_code": "<string>",
"total_discount": "0.00",
"buyer_id_type": "<string>",
"buyer_id": "<string>",
"buyer_name": "<string>",
"buyer_email": "<string>",
"buyer_address": "<string>",
"modified_document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"modified_document_type": "<string>",
"modified_document_number": "<string>",
"modified_document_issue_date": "2023-12-25",
"reason": "<string>",
"idempotency_key": "<string>",
"payments": [
{
"line_number": 2,
"payment_method_code": "<string>",
"total": 1,
"term": 1,
"time_unit": "<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({
issuer_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
establishment_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
emission_point_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
issue_date: '2023-12-25',
subtotal: 1,
total_tax: 1,
total: 1,
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
}
],
numeric_code: '<string>',
total_discount: '0.00',
buyer_id_type: '<string>',
buyer_id: '<string>',
buyer_name: '<string>',
buyer_email: '<string>',
buyer_address: '<string>',
modified_document_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
modified_document_type: '<string>',
modified_document_number: '<string>',
modified_document_issue_date: '2023-12-25',
reason: '<string>',
idempotency_key: '<string>',
payments: [
{
line_number: 2,
payment_method_code: '<string>',
total: 1,
term: 1,
time_unit: '<string>'
}
]
})
};
fetch('http://localhost:8000/documents/drafts', 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/drafts",
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([
'issuer_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'establishment_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'emission_point_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'issue_date' => '2023-12-25',
'subtotal' => 1,
'total_tax' => 1,
'total' => 1,
'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
]
],
'numeric_code' => '<string>',
'total_discount' => '0.00',
'buyer_id_type' => '<string>',
'buyer_id' => '<string>',
'buyer_name' => '<string>',
'buyer_email' => '<string>',
'buyer_address' => '<string>',
'modified_document_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'modified_document_type' => '<string>',
'modified_document_number' => '<string>',
'modified_document_issue_date' => '2023-12-25',
'reason' => '<string>',
'idempotency_key' => '<string>',
'payments' => [
[
'line_number' => 2,
'payment_method_code' => '<string>',
'total' => 1,
'term' => 1,
'time_unit' => '<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/drafts"
payload := strings.NewReader("{\n \"issuer_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"establishment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"emission_point_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"issue_date\": \"2023-12-25\",\n \"subtotal\": 1,\n \"total_tax\": 1,\n \"total\": 1,\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 \"numeric_code\": \"<string>\",\n \"total_discount\": \"0.00\",\n \"buyer_id_type\": \"<string>\",\n \"buyer_id\": \"<string>\",\n \"buyer_name\": \"<string>\",\n \"buyer_email\": \"<string>\",\n \"buyer_address\": \"<string>\",\n \"modified_document_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"modified_document_type\": \"<string>\",\n \"modified_document_number\": \"<string>\",\n \"modified_document_issue_date\": \"2023-12-25\",\n \"reason\": \"<string>\",\n \"idempotency_key\": \"<string>\",\n \"payments\": [\n {\n \"line_number\": 2,\n \"payment_method_code\": \"<string>\",\n \"total\": 1,\n \"term\": 1,\n \"time_unit\": \"<string>\"\n }\n ]\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/drafts")
.header("Content-Type", "application/json")
.body("{\n \"issuer_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"establishment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"emission_point_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"issue_date\": \"2023-12-25\",\n \"subtotal\": 1,\n \"total_tax\": 1,\n \"total\": 1,\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 \"numeric_code\": \"<string>\",\n \"total_discount\": \"0.00\",\n \"buyer_id_type\": \"<string>\",\n \"buyer_id\": \"<string>\",\n \"buyer_name\": \"<string>\",\n \"buyer_email\": \"<string>\",\n \"buyer_address\": \"<string>\",\n \"modified_document_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"modified_document_type\": \"<string>\",\n \"modified_document_number\": \"<string>\",\n \"modified_document_issue_date\": \"2023-12-25\",\n \"reason\": \"<string>\",\n \"idempotency_key\": \"<string>\",\n \"payments\": [\n {\n \"line_number\": 2,\n \"payment_method_code\": \"<string>\",\n \"total\": 1,\n \"term\": 1,\n \"time_unit\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8000/documents/drafts")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"issuer_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"establishment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"emission_point_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"issue_date\": \"2023-12-25\",\n \"subtotal\": 1,\n \"total_tax\": 1,\n \"total\": 1,\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 \"numeric_code\": \"<string>\",\n \"total_discount\": \"0.00\",\n \"buyer_id_type\": \"<string>\",\n \"buyer_id\": \"<string>\",\n \"buyer_name\": \"<string>\",\n \"buyer_email\": \"<string>\",\n \"buyer_address\": \"<string>\",\n \"modified_document_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"modified_document_type\": \"<string>\",\n \"modified_document_number\": \"<string>\",\n \"modified_document_issue_date\": \"2023-12-25\",\n \"reason\": \"<string>\",\n \"idempotency_key\": \"<string>\",\n \"payments\": [\n {\n \"line_number\": 2,\n \"payment_method_code\": \"<string>\",\n \"total\": 1,\n \"term\": 1,\n \"time_unit\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"issuer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"establishment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"emission_point_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sequential": 123,
"access_key": "<string>",
"idempotency_key": "<string>",
"issue_date": "2023-12-25",
"subtotal": "<string>",
"total_discount": "<string>",
"total_tax": "<string>",
"total": "<string>",
"buyer_id_type": "<string>",
"buyer_id": "<string>",
"buyer_name": "<string>",
"buyer_email": "<string>",
"buyer_address": "<string>",
"modified_document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"modified_document_type": "<string>",
"modified_document_number": "<string>",
"modified_document_issue_date": "2023-12-25",
"reason": "<string>",
"authorization_number": "<string>",
"authorization_date": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"payments": []
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Create Document Draft
Create a document in DRAFT state without reserving a sequential.
curl --request POST \
--url http://localhost:8000/documents/drafts \
--header 'Content-Type: application/json' \
--data '
{
"issuer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"establishment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"emission_point_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"issue_date": "2023-12-25",
"subtotal": 1,
"total_tax": 1,
"total": 1,
"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
}
],
"numeric_code": "<string>",
"total_discount": "0.00",
"buyer_id_type": "<string>",
"buyer_id": "<string>",
"buyer_name": "<string>",
"buyer_email": "<string>",
"buyer_address": "<string>",
"modified_document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"modified_document_type": "<string>",
"modified_document_number": "<string>",
"modified_document_issue_date": "2023-12-25",
"reason": "<string>",
"idempotency_key": "<string>",
"payments": [
{
"line_number": 2,
"payment_method_code": "<string>",
"total": 1,
"term": 1,
"time_unit": "<string>"
}
]
}
'import requests
url = "http://localhost:8000/documents/drafts"
payload = {
"issuer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"establishment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"emission_point_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"issue_date": "2023-12-25",
"subtotal": 1,
"total_tax": 1,
"total": 1,
"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
}
],
"numeric_code": "<string>",
"total_discount": "0.00",
"buyer_id_type": "<string>",
"buyer_id": "<string>",
"buyer_name": "<string>",
"buyer_email": "<string>",
"buyer_address": "<string>",
"modified_document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"modified_document_type": "<string>",
"modified_document_number": "<string>",
"modified_document_issue_date": "2023-12-25",
"reason": "<string>",
"idempotency_key": "<string>",
"payments": [
{
"line_number": 2,
"payment_method_code": "<string>",
"total": 1,
"term": 1,
"time_unit": "<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({
issuer_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
establishment_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
emission_point_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
issue_date: '2023-12-25',
subtotal: 1,
total_tax: 1,
total: 1,
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
}
],
numeric_code: '<string>',
total_discount: '0.00',
buyer_id_type: '<string>',
buyer_id: '<string>',
buyer_name: '<string>',
buyer_email: '<string>',
buyer_address: '<string>',
modified_document_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
modified_document_type: '<string>',
modified_document_number: '<string>',
modified_document_issue_date: '2023-12-25',
reason: '<string>',
idempotency_key: '<string>',
payments: [
{
line_number: 2,
payment_method_code: '<string>',
total: 1,
term: 1,
time_unit: '<string>'
}
]
})
};
fetch('http://localhost:8000/documents/drafts', 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/drafts",
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([
'issuer_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'establishment_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'emission_point_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'issue_date' => '2023-12-25',
'subtotal' => 1,
'total_tax' => 1,
'total' => 1,
'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
]
],
'numeric_code' => '<string>',
'total_discount' => '0.00',
'buyer_id_type' => '<string>',
'buyer_id' => '<string>',
'buyer_name' => '<string>',
'buyer_email' => '<string>',
'buyer_address' => '<string>',
'modified_document_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'modified_document_type' => '<string>',
'modified_document_number' => '<string>',
'modified_document_issue_date' => '2023-12-25',
'reason' => '<string>',
'idempotency_key' => '<string>',
'payments' => [
[
'line_number' => 2,
'payment_method_code' => '<string>',
'total' => 1,
'term' => 1,
'time_unit' => '<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/drafts"
payload := strings.NewReader("{\n \"issuer_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"establishment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"emission_point_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"issue_date\": \"2023-12-25\",\n \"subtotal\": 1,\n \"total_tax\": 1,\n \"total\": 1,\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 \"numeric_code\": \"<string>\",\n \"total_discount\": \"0.00\",\n \"buyer_id_type\": \"<string>\",\n \"buyer_id\": \"<string>\",\n \"buyer_name\": \"<string>\",\n \"buyer_email\": \"<string>\",\n \"buyer_address\": \"<string>\",\n \"modified_document_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"modified_document_type\": \"<string>\",\n \"modified_document_number\": \"<string>\",\n \"modified_document_issue_date\": \"2023-12-25\",\n \"reason\": \"<string>\",\n \"idempotency_key\": \"<string>\",\n \"payments\": [\n {\n \"line_number\": 2,\n \"payment_method_code\": \"<string>\",\n \"total\": 1,\n \"term\": 1,\n \"time_unit\": \"<string>\"\n }\n ]\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/drafts")
.header("Content-Type", "application/json")
.body("{\n \"issuer_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"establishment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"emission_point_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"issue_date\": \"2023-12-25\",\n \"subtotal\": 1,\n \"total_tax\": 1,\n \"total\": 1,\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 \"numeric_code\": \"<string>\",\n \"total_discount\": \"0.00\",\n \"buyer_id_type\": \"<string>\",\n \"buyer_id\": \"<string>\",\n \"buyer_name\": \"<string>\",\n \"buyer_email\": \"<string>\",\n \"buyer_address\": \"<string>\",\n \"modified_document_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"modified_document_type\": \"<string>\",\n \"modified_document_number\": \"<string>\",\n \"modified_document_issue_date\": \"2023-12-25\",\n \"reason\": \"<string>\",\n \"idempotency_key\": \"<string>\",\n \"payments\": [\n {\n \"line_number\": 2,\n \"payment_method_code\": \"<string>\",\n \"total\": 1,\n \"term\": 1,\n \"time_unit\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8000/documents/drafts")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"issuer_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"establishment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"emission_point_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"issue_date\": \"2023-12-25\",\n \"subtotal\": 1,\n \"total_tax\": 1,\n \"total\": 1,\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 \"numeric_code\": \"<string>\",\n \"total_discount\": \"0.00\",\n \"buyer_id_type\": \"<string>\",\n \"buyer_id\": \"<string>\",\n \"buyer_name\": \"<string>\",\n \"buyer_email\": \"<string>\",\n \"buyer_address\": \"<string>\",\n \"modified_document_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"modified_document_type\": \"<string>\",\n \"modified_document_number\": \"<string>\",\n \"modified_document_issue_date\": \"2023-12-25\",\n \"reason\": \"<string>\",\n \"idempotency_key\": \"<string>\",\n \"payments\": [\n {\n \"line_number\": 2,\n \"payment_method_code\": \"<string>\",\n \"total\": 1,\n \"term\": 1,\n \"time_unit\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"issuer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"establishment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"emission_point_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sequential": 123,
"access_key": "<string>",
"idempotency_key": "<string>",
"issue_date": "2023-12-25",
"subtotal": "<string>",
"total_discount": "<string>",
"total_tax": "<string>",
"total": "<string>",
"buyer_id_type": "<string>",
"buyer_id": "<string>",
"buyer_name": "<string>",
"buyer_email": "<string>",
"buyer_address": "<string>",
"modified_document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"modified_document_type": "<string>",
"modified_document_number": "<string>",
"modified_document_issue_date": "2023-12-25",
"reason": "<string>",
"authorization_number": "<string>",
"authorization_date": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"payments": []
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Cookies
Body
Schema for creating a document (invoice, credit note, etc.).
Types of fiscal documents supported by the SRI.
01, 04, 05, 06, 07 Subtotal before taxes and discounts
x >= 0Total tax amount
x >= 0Total amount (subtotal - discount + tax)
x >= 0Document line items
1Show child attributes
Show child attributes
Document tax entries
1Show child attributes
Show child attributes
8-digit numeric code for access key generation
8^\d{8}$Total discount amount
x >= 0Buyer identification type (RUC, cedula, passport, etc.)
10Buyer identification number
20Buyer name
300Buyer email address
255Buyer address
500Original document referenced by this document
SRI type code of the modified document
2Formatted document number of the modified document
20Issue date of the modified document
Reason for the document, mainly required for credit notes
500Client-provided idempotency key to prevent duplicate submissions
255SRI payment method entries
Show child attributes
Show child attributes
Response
Successful Response
Schema for Document response — current state and authorization info.
Types of fiscal documents supported by the SRI.
01, 04, 05, 06, 07 Status values for document lifecycle.
DRAFT, VALIDATED, NUMBER_RESERVED, XML_GENERATED, SIGNED, RECEPTION_PENDING, SUBMITTED_TO_SRI, RECEIVED_BY_SRI, AUTHORIZATION_PENDING, AUTHORIZED, REJECTED, RECEPTION_RETRY_SCHEDULED, AUTHORIZATION_RETRY_SCHEDULED, RECEPTION_UNKNOWN, AUTHORIZATION_UNKNOWN, MANUAL_REVIEW_REQUIRED, FAILED_PERMANENT, CANCELLATION_REQUESTED, CANCELLED, VOIDED_BY_NC ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$SRI environment types.
TEST, PRODUCTION Show child attributes
Show child attributes