Cancel tax documents in batch
curl --request POST \
--url https://api.accounting.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/tax-document/batch-cancel \
--header 'Content-Type: multipart/form-data' \
--form file=@example-fileimport requests
url = "https://api.accounting.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/tax-document/batch-cancel"
files = { "file": ("example-file", open("example-file", "rb")) }
response = requests.post(url, files=files)
print(response.text)const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST'};
options.body = form;
fetch('https://api.accounting.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/tax-document/batch-cancel', 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.accounting.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/tax-document/batch-cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data"
],
]);
$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.accounting.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/tax-document/batch-cancel"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
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.accounting.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/tax-document/batch-cancel")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.accounting.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/tax-document/batch-cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"message": "Batch cancellation requested.",
"count": 25
}{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "TAX_ISSUER_PROVIDER_ID_NOT_FOUND",
"origin": "ACCOUNTING",
"message": "Tax issuer provider id not exists"
}{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "TAX_ISSUER_NOT_FOUND",
"origin": "ACCOUNTING",
"message": "Tax issuer not found"
}{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "BAD_REQUEST",
"origin": "ACCOUNTING",
"message": "Bad Request: Your request is invalid or incomplete. Please make sure you are requesting with the right fields.",
"fields": [
{
"field": "file",
"message": "file is required",
"code": "FILE_REQUIRED"
}
]
}Cancel tax documents in batch
Requests the cancellation of every tax document listed in an uploaded CSV file.
POST
/
realms
/
{realmId}
/
organizations
/
{organizationId}
/
tax-document
/
batch-cancel
Cancel tax documents in batch
curl --request POST \
--url https://api.accounting.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/tax-document/batch-cancel \
--header 'Content-Type: multipart/form-data' \
--form file=@example-fileimport requests
url = "https://api.accounting.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/tax-document/batch-cancel"
files = { "file": ("example-file", open("example-file", "rb")) }
response = requests.post(url, files=files)
print(response.text)const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST'};
options.body = form;
fetch('https://api.accounting.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/tax-document/batch-cancel', 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.accounting.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/tax-document/batch-cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data"
],
]);
$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.accounting.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/tax-document/batch-cancel"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
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.accounting.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/tax-document/batch-cancel")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.accounting.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/tax-document/batch-cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"message": "Batch cancellation requested.",
"count": 25
}{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "TAX_ISSUER_PROVIDER_ID_NOT_FOUND",
"origin": "ACCOUNTING",
"message": "Tax issuer provider id not exists"
}{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "TAX_ISSUER_NOT_FOUND",
"origin": "ACCOUNTING",
"message": "Tax issuer not found"
}{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "BAD_REQUEST",
"origin": "ACCOUNTING",
"message": "Bad Request: Your request is invalid or incomplete. Please make sure you are requesting with the right fields.",
"fields": [
{
"field": "file",
"message": "file is required",
"code": "FILE_REQUIRED"
}
]
}Send a
Only the
multipart/form-data request whose file part is a CSV file: comma-separated, with a header row and one row per tax document to cancel.
| Column | Required | Meaning |
|---|---|---|
taxDocumentId | Yes | ID of the tax document to cancel: the id of a document returned by the tax documents list. |
taxDocumentId column is read; every other column is ignored, so the export of your tax documents can be uploaded as it is. A row without a valid taxDocumentId is rejected.
The whole upload is validated first: if any row is invalid nothing is cancelled, and fields points at the row by its position, where taxDocuments[0] is the first row after the header. When the upload is valid, the response only means the rows were accepted. The cancellation of each tax document is then requested in the background, so a row can still fail later: a tax document that is not one of your organization’s is not cancelled, and one that cannot be cancelled in its current state, for example because it is not authorized yet, is skipped. Upload each tax document once, because asking again to cancel one that is already being cancelled fails.Path Parameters
ID of your realm.
Format: UUID
ID of the organization.
Format: UUID
Body
multipart/form-data
The CSV file, with a header row and one row per tax document to cancel. Only the taxDocumentId column is read; see the operation description. Required, not empty, at most 4 MB; its file name must end in .csv, or its content type be text/csv, application/vnd.ms-excel or text/plain.
Response
Successful response
Acknowledgement that a CSV batch was accepted. Each row is processed in the background.