Companies
Link digital certificate
Uploads the company A1 digital certificate (.pfx / .p12) and its password; accepts JSON + Base64 or multipart.
/openapi/v1/empresas/{empresaId}/certificadoDigitaltoken, timestamp and sign signature headers, see Authentication.The same path accepts two request shapes, selected by Content-Type: use JSON + Base64 (this page) when you only hold the certificate bytes; use multipart (section below) when you hold the certificate as a file. Validation and outcome are identical for both shapes. A successful upload replaces the company previous certificate.
Headers
Content-Type* | string | Body type |
* Required field
Path parameters
empresaId* | string | Company identifier |
* Required field
Request body
senha* | string | Certificate password |
arquivoBase64* | string | Certificate in Base64 |
* Required field
No response body
For the JSON shape the body is part of the signature: raw body with CR/LF removed, same as every other JSON endpoint. Produce standard Base64 without line breaks.
APP_SECRET="sk_live_9f8e7d6c5b4a"P="/openapi/v1/empresas/1934811222334455/certificadoDigital"TS=$(date +%s)BODY=$(printf '{"senha":"certpass123","arquivoBase64":"%s"}' "$(base64 -w0 uploaded-cert.pfx)")SIGN=$(printf '%s' "${APP_SECRET}${P}${BODY}${TS}" | md5sum | cut -d' ' -f1)curl -X POST "https://api.v2.tffiscal.com${P}" \-H "token: ${APP_SECRET}" -H "timestamp: ${TS}" -H "sign: ${SIGN}" \-H "Content-Type: application/json" --data-binary "${BODY}"
Send Content-Type: multipart/form-data with the two form fields below. In the signature the body is the empty string: sign = MD5(token + path + timestamp).
APP_SECRET="sk_live_9f8e7d6c5b4a"P="/openapi/v1/empresas/1934811222334455/certificadoDigital"TS=$(date +%s)SIGN=$(printf '%s' "${APP_SECRET}${P}${TS}" | md5sum | cut -d' ' -f1)curl -X POST "https://api.v2.tffiscal.com${P}" \-H "token: ${APP_SECRET}" -H "timestamp: ${TS}" -H "sign: ${SIGN}" \-F "senha=certpass123" -F "arquivo=@uploaded-cert.pfx"
Form fields
senha* | text | Certificate password |
arquivo* | file | Certificate file |
* Required field
Success is HTTP 200 with no body. No endpoint ever returns the certificate content or its password.
The company only becomes issuable once, in addition to the certificate, the operations approval is complete; see the lifecycle in Companies.
Content-TypeRequest shape
| Values | Meaning |
|---|---|
| application/json | JSON + Base64: senha and arquivoBase64 in the body; the body is part of the signature |
| multipart/form-data | Multipart: form fields senha and arquivo; the body is the empty string in the signature |
| Code | HTTP | |
|---|---|---|
| 10003000 | 404 | empresaId does not exist or does not belong to this application. |
| 10003035 | 400 | Invalid Base64 or file above 1MB after decoding. JSON shape only. |
| 10003008 | 400 | Certificate password mismatch. Check the password. |
| 10003010 | 400 | Certificate CNPJ does not match the company. Use the correct certificate. |
| 10003011 | 400 | Certificate expired. Use a valid certificate. |
| 10003012 | 400 | Certificate identical to the one currently active for the company. |
