Upload your digital certificate
curl --request POST \
--url https://api.accounting.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/tax-issuer/{taxIssuer}/secrets \
--header 'Content-Type: multipart/form-data' \
--form file=@example-file \
--form pwsCertificate=your-certificate-passwordimport requests
url = "https://api.accounting.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/tax-issuer/{taxIssuer}/secrets"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = { "pwsCertificate": "your-certificate-password" }
response = requests.post(url, data=payload, files=files)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('pwsCertificate', 'your-certificate-password');
const options = {method: 'POST'};
options.body = form;
fetch('https://api.accounting.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/tax-issuer/{taxIssuer}/secrets', 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-issuer/{taxIssuer}/secrets",
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\r\nContent-Disposition: form-data; name=\"pwsCertificate\"\r\n\r\nyour-certificate-password\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-issuer/{taxIssuer}/secrets"
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\r\nContent-Disposition: form-data; name=\"pwsCertificate\"\r\n\r\nyour-certificate-password\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-issuer/{taxIssuer}/secrets")
.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\r\nContent-Disposition: form-data; name=\"pwsCertificate\"\r\n\r\nyour-certificate-password\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.accounting.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/tax-issuer/{taxIssuer}/secrets")
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\r\nContent-Disposition: form-data; name=\"pwsCertificate\"\r\n\r\nyour-certificate-password\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"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"
}
]
}Upload your digital certificate
Uploads the digital certificate your organization uses to sign its service invoices (NFSe).
POST
/
realms
/
{realmId}
/
organizations
/
{organizationId}
/
tax-issuer
/
{taxIssuer}
/
secrets
Upload your digital certificate
curl --request POST \
--url https://api.accounting.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/tax-issuer/{taxIssuer}/secrets \
--header 'Content-Type: multipart/form-data' \
--form file=@example-file \
--form pwsCertificate=your-certificate-passwordimport requests
url = "https://api.accounting.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/tax-issuer/{taxIssuer}/secrets"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = { "pwsCertificate": "your-certificate-password" }
response = requests.post(url, data=payload, files=files)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('pwsCertificate', 'your-certificate-password');
const options = {method: 'POST'};
options.body = form;
fetch('https://api.accounting.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/tax-issuer/{taxIssuer}/secrets', 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-issuer/{taxIssuer}/secrets",
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\r\nContent-Disposition: form-data; name=\"pwsCertificate\"\r\n\r\nyour-certificate-password\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-issuer/{taxIssuer}/secrets"
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\r\nContent-Disposition: form-data; name=\"pwsCertificate\"\r\n\r\nyour-certificate-password\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-issuer/{taxIssuer}/secrets")
.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\r\nContent-Disposition: form-data; name=\"pwsCertificate\"\r\n\r\nyour-certificate-password\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.accounting.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/tax-issuer/{taxIssuer}/secrets")
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\r\nContent-Disposition: form-data; name=\"pwsCertificate\"\r\n\r\nyour-certificate-password\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"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 the certificate as
multipart/form-data: the file in the part file and its password in the part pwsCertificate. It is your organization’s ICP-Brasil A1 certificate (a .pfx or .p12 file of up to 1 MB), which signs each NFSe at the city hall. One certificate serves both the TEST and the LIVE environment, and uploading a new one replaces the previous. Once it is uploaded, hasCertificate is true on Get your tax issuer.
If the tax provider rejects the request, the error is returned with the provider’s error code and a status of 400, 409, 422 or 502.Path Parameters
ID of your realm.
Format: UUID
ID of the organization.
Format: UUID
ID of your tax issuer — the id returned by Get your tax issuer.
Format: UUID
Body
multipart/form-data
Your digital certificate (ICP-Brasil A1), as a multipart/form-data file part. It must be a .pfx or .p12 file (or be sent with the content type application/x-pkcs12 or application/pkcs12) of up to 1 MB (1,048,576 bytes).
Password of the certificate file.
Minimum string length:
1Example:
"your-certificate-password"
Response
No Content. The operation succeeded and the response has no body.