Patch Document Draft Endpoint
curl --request PATCH \
--url http://localhost:8000/documents/{document_id}/draft \
--header 'Content-Type: application/json' \
--data '
{
"lines": [
{
"line_number": 123,
"description": "<string>",
"quantity": 123,
"unit_price": 123,
"discount": 123,
"subtotal": 123,
"tax_rate_code": "<string>",
"main_code": "<string>",
"aux_code": "<string>",
"tax_code": "2"
}
],
"taxes": [
{
"tax_code": "<string>",
"tax_rate_code": "<string>",
"taxable_base": 123,
"rate": 123,
"tax_amount": 123
}
],
"subtotal": 123,
"total_discount": 123,
"total_tax": 123,
"total": 123
}
'import requests
url = "http://localhost:8000/documents/{document_id}/draft"
payload = {
"lines": [
{
"line_number": 123,
"description": "<string>",
"quantity": 123,
"unit_price": 123,
"discount": 123,
"subtotal": 123,
"tax_rate_code": "<string>",
"main_code": "<string>",
"aux_code": "<string>",
"tax_code": "2"
}
],
"taxes": [
{
"tax_code": "<string>",
"tax_rate_code": "<string>",
"taxable_base": 123,
"rate": 123,
"tax_amount": 123
}
],
"subtotal": 123,
"total_discount": 123,
"total_tax": 123,
"total": 123
}
headers = {"Content-Type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
lines: [
{
line_number: 123,
description: '<string>',
quantity: 123,
unit_price: 123,
discount: 123,
subtotal: 123,
tax_rate_code: '<string>',
main_code: '<string>',
aux_code: '<string>',
tax_code: '2'
}
],
taxes: [
{
tax_code: '<string>',
tax_rate_code: '<string>',
taxable_base: 123,
rate: 123,
tax_amount: 123
}
],
subtotal: 123,
total_discount: 123,
total_tax: 123,
total: 123
})
};
fetch('http://localhost:8000/documents/{document_id}/draft', 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}/draft",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'lines' => [
[
'line_number' => 123,
'description' => '<string>',
'quantity' => 123,
'unit_price' => 123,
'discount' => 123,
'subtotal' => 123,
'tax_rate_code' => '<string>',
'main_code' => '<string>',
'aux_code' => '<string>',
'tax_code' => '2'
]
],
'taxes' => [
[
'tax_code' => '<string>',
'tax_rate_code' => '<string>',
'taxable_base' => 123,
'rate' => 123,
'tax_amount' => 123
]
],
'subtotal' => 123,
'total_discount' => 123,
'total_tax' => 123,
'total' => 123
]),
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}/draft"
payload := strings.NewReader("{\n \"lines\": [\n {\n \"line_number\": 123,\n \"description\": \"<string>\",\n \"quantity\": 123,\n \"unit_price\": 123,\n \"discount\": 123,\n \"subtotal\": 123,\n \"tax_rate_code\": \"<string>\",\n \"main_code\": \"<string>\",\n \"aux_code\": \"<string>\",\n \"tax_code\": \"2\"\n }\n ],\n \"taxes\": [\n {\n \"tax_code\": \"<string>\",\n \"tax_rate_code\": \"<string>\",\n \"taxable_base\": 123,\n \"rate\": 123,\n \"tax_amount\": 123\n }\n ],\n \"subtotal\": 123,\n \"total_discount\": 123,\n \"total_tax\": 123,\n \"total\": 123\n}")
req, _ := http.NewRequest("PATCH", 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.patch("http://localhost:8000/documents/{document_id}/draft")
.header("Content-Type", "application/json")
.body("{\n \"lines\": [\n {\n \"line_number\": 123,\n \"description\": \"<string>\",\n \"quantity\": 123,\n \"unit_price\": 123,\n \"discount\": 123,\n \"subtotal\": 123,\n \"tax_rate_code\": \"<string>\",\n \"main_code\": \"<string>\",\n \"aux_code\": \"<string>\",\n \"tax_code\": \"2\"\n }\n ],\n \"taxes\": [\n {\n \"tax_code\": \"<string>\",\n \"tax_rate_code\": \"<string>\",\n \"taxable_base\": 123,\n \"rate\": 123,\n \"tax_amount\": 123\n }\n ],\n \"subtotal\": 123,\n \"total_discount\": 123,\n \"total_tax\": 123,\n \"total\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8000/documents/{document_id}/draft")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"lines\": [\n {\n \"line_number\": 123,\n \"description\": \"<string>\",\n \"quantity\": 123,\n \"unit_price\": 123,\n \"discount\": 123,\n \"subtotal\": 123,\n \"tax_rate_code\": \"<string>\",\n \"main_code\": \"<string>\",\n \"aux_code\": \"<string>\",\n \"tax_code\": \"2\"\n }\n ],\n \"taxes\": [\n {\n \"tax_code\": \"<string>\",\n \"tax_rate_code\": \"<string>\",\n \"taxable_base\": 123,\n \"rate\": 123,\n \"tax_amount\": 123\n }\n ],\n \"subtotal\": 123,\n \"total_discount\": 123,\n \"total_tax\": 123,\n \"total\": 123\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": {}
}
]
}documents
Patch Document Draft Endpoint
Replace lines/taxes and recalculate totals on a DRAFT document.
PATCH
/
documents
/
{document_id}
/
draft
Patch Document Draft Endpoint
curl --request PATCH \
--url http://localhost:8000/documents/{document_id}/draft \
--header 'Content-Type: application/json' \
--data '
{
"lines": [
{
"line_number": 123,
"description": "<string>",
"quantity": 123,
"unit_price": 123,
"discount": 123,
"subtotal": 123,
"tax_rate_code": "<string>",
"main_code": "<string>",
"aux_code": "<string>",
"tax_code": "2"
}
],
"taxes": [
{
"tax_code": "<string>",
"tax_rate_code": "<string>",
"taxable_base": 123,
"rate": 123,
"tax_amount": 123
}
],
"subtotal": 123,
"total_discount": 123,
"total_tax": 123,
"total": 123
}
'import requests
url = "http://localhost:8000/documents/{document_id}/draft"
payload = {
"lines": [
{
"line_number": 123,
"description": "<string>",
"quantity": 123,
"unit_price": 123,
"discount": 123,
"subtotal": 123,
"tax_rate_code": "<string>",
"main_code": "<string>",
"aux_code": "<string>",
"tax_code": "2"
}
],
"taxes": [
{
"tax_code": "<string>",
"tax_rate_code": "<string>",
"taxable_base": 123,
"rate": 123,
"tax_amount": 123
}
],
"subtotal": 123,
"total_discount": 123,
"total_tax": 123,
"total": 123
}
headers = {"Content-Type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
lines: [
{
line_number: 123,
description: '<string>',
quantity: 123,
unit_price: 123,
discount: 123,
subtotal: 123,
tax_rate_code: '<string>',
main_code: '<string>',
aux_code: '<string>',
tax_code: '2'
}
],
taxes: [
{
tax_code: '<string>',
tax_rate_code: '<string>',
taxable_base: 123,
rate: 123,
tax_amount: 123
}
],
subtotal: 123,
total_discount: 123,
total_tax: 123,
total: 123
})
};
fetch('http://localhost:8000/documents/{document_id}/draft', 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}/draft",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'lines' => [
[
'line_number' => 123,
'description' => '<string>',
'quantity' => 123,
'unit_price' => 123,
'discount' => 123,
'subtotal' => 123,
'tax_rate_code' => '<string>',
'main_code' => '<string>',
'aux_code' => '<string>',
'tax_code' => '2'
]
],
'taxes' => [
[
'tax_code' => '<string>',
'tax_rate_code' => '<string>',
'taxable_base' => 123,
'rate' => 123,
'tax_amount' => 123
]
],
'subtotal' => 123,
'total_discount' => 123,
'total_tax' => 123,
'total' => 123
]),
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}/draft"
payload := strings.NewReader("{\n \"lines\": [\n {\n \"line_number\": 123,\n \"description\": \"<string>\",\n \"quantity\": 123,\n \"unit_price\": 123,\n \"discount\": 123,\n \"subtotal\": 123,\n \"tax_rate_code\": \"<string>\",\n \"main_code\": \"<string>\",\n \"aux_code\": \"<string>\",\n \"tax_code\": \"2\"\n }\n ],\n \"taxes\": [\n {\n \"tax_code\": \"<string>\",\n \"tax_rate_code\": \"<string>\",\n \"taxable_base\": 123,\n \"rate\": 123,\n \"tax_amount\": 123\n }\n ],\n \"subtotal\": 123,\n \"total_discount\": 123,\n \"total_tax\": 123,\n \"total\": 123\n}")
req, _ := http.NewRequest("PATCH", 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.patch("http://localhost:8000/documents/{document_id}/draft")
.header("Content-Type", "application/json")
.body("{\n \"lines\": [\n {\n \"line_number\": 123,\n \"description\": \"<string>\",\n \"quantity\": 123,\n \"unit_price\": 123,\n \"discount\": 123,\n \"subtotal\": 123,\n \"tax_rate_code\": \"<string>\",\n \"main_code\": \"<string>\",\n \"aux_code\": \"<string>\",\n \"tax_code\": \"2\"\n }\n ],\n \"taxes\": [\n {\n \"tax_code\": \"<string>\",\n \"tax_rate_code\": \"<string>\",\n \"taxable_base\": 123,\n \"rate\": 123,\n \"tax_amount\": 123\n }\n ],\n \"subtotal\": 123,\n \"total_discount\": 123,\n \"total_tax\": 123,\n \"total\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8000/documents/{document_id}/draft")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"lines\": [\n {\n \"line_number\": 123,\n \"description\": \"<string>\",\n \"quantity\": 123,\n \"unit_price\": 123,\n \"discount\": 123,\n \"subtotal\": 123,\n \"tax_rate_code\": \"<string>\",\n \"main_code\": \"<string>\",\n \"aux_code\": \"<string>\",\n \"tax_code\": \"2\"\n }\n ],\n \"taxes\": [\n {\n \"tax_code\": \"<string>\",\n \"tax_rate_code\": \"<string>\",\n \"taxable_base\": 123,\n \"rate\": 123,\n \"tax_amount\": 123\n }\n ],\n \"subtotal\": 123,\n \"total_discount\": 123,\n \"total_tax\": 123,\n \"total\": 123\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": {}
}
]
}Path Parameters
Cookies
Body
application/json
Response
Successful Response
Schema for Document response — current state and authorization info.
Types of fiscal documents supported by the SRI.
Available options:
01, 04, 05, 06, 07 Status values for document lifecycle.
Available options:
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 Pattern:
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$Pattern:
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$Pattern:
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$Pattern:
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$SRI environment types.
Available options:
TEST, PRODUCTION Show child attributes
Show child attributes
⌘I