Upload Certificates
curl --request PUT \
--url https://api.example.com/organizations/{id}/certificates \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"password": "<string>"
}
'import requests
url = "https://api.example.com/organizations/{id}/certificates"
payload = { "password": "<string>" }
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({password: '<string>'})
};
fetch('https://api.example.com/organizations/{id}/certificates', 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.example.com/organizations/{id}/certificates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'password' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"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 := "https://api.example.com/organizations/{id}/certificates"
payload := strings.NewReader("{\n \"password\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<authorization>")
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.put("https://api.example.com/organizations/{id}/certificates")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"password\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/organizations/{id}/certificates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"password\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"200": {},
"400": {},
"401": {},
"403": {},
"404": {},
"certificateSerialNumber": "<string>",
"certificateExpiresAt": "<string>",
"certificateUpdatedAt": "<string>",
"rfc": "<string>"
}Organizations
Upload Certificates
Upload CSD certificate and private key for invoice signing
PUT
/
organizations
/
{id}
/
certificates
Upload Certificates
curl --request PUT \
--url https://api.example.com/organizations/{id}/certificates \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"password": "<string>"
}
'import requests
url = "https://api.example.com/organizations/{id}/certificates"
payload = { "password": "<string>" }
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({password: '<string>'})
};
fetch('https://api.example.com/organizations/{id}/certificates', 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.example.com/organizations/{id}/certificates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'password' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"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 := "https://api.example.com/organizations/{id}/certificates"
payload := strings.NewReader("{\n \"password\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<authorization>")
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.put("https://api.example.com/organizations/{id}/certificates")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"password\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/organizations/{id}/certificates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"password\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"200": {},
"400": {},
"401": {},
"403": {},
"404": {},
"certificateSerialNumber": "<string>",
"certificateExpiresAt": "<string>",
"certificateUpdatedAt": "<string>",
"rfc": "<string>"
}Description
Uploads CSD (Certificado de Sello Digital) certificate and private key files for electronic invoice signing. Files are encrypted with AWS KMS and stored securely in S3. Only the organization owner can perform this action.The SAT’s public test CSDs (for example RFC
EKU9003173C9) are accepted, but
they never count toward production readiness: the organization’s
pending_steps keeps a csd step until you upload the CSD issued for your
own RFC. Sandbox stamping doesn’t need your CSD at all.Authorization
Path Parameters
Body Parameters (multipart/form-data)
Response
Example Request
curl -X PUT "https://api.timbrix.mx/organizations/123e4567-e89b-12d3-a456-426614174000/certificates" \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "certificate=@/path/to/certificate.cer" \
-F "privateKey=@/path/to/private.key" \
-F "password=your_certificate_password"
import { readFile } from "node:fs/promises"
import { Timbrix } from "@timbrix/sdk"
const client = new Timbrix({ bearerToken: "<your_token>" })
const result = await client.organizations.uploadCertificates(
"123e4567-e89b-12d3-a456-426614174000",
{
certificate: await readFile("/path/to/certificate.cer"),
privateKey: await readFile("/path/to/private.key"),
password: "your_certificate_password",
}
)
console.log(result.certificateExpiresAt)
certificate and privateKey accept a Buffer/Uint8Array (Node.js) or a
Blob/File (browser, e.g. from an <input type="file">). The SDK sends
them as multipart/form-data with the required .cer/.key file names.Example Response
{
"certificateSerialNumber": "30001000000400002463",
"certificateExpiresAt": "2028-05-15T00:00:00.000Z",
"certificateUpdatedAt": "2024-01-15T10:30:00.000Z",
"rfc": "XAXX010101000"
}
Response Codes
Security
⚠️ OWNER ONLY: Only the organization OWNER can upload CSD certificates. Admins and members cannot perform this action. 🔐 Encryption: All certificate files are encrypted with AWS KMS (Server-Side Encryption) before being stored in S3. The certificate password is also encrypted with KMS before being stored in the database.Notes
- Certificate file must have
.cerextension - Private key file must have
.keyextension - Maximum file size is 10MB per file
- Expired certificates will be rejected
- Certificate metadata (serial number, expiration date, RFC) is automatically extracted
- Previous certificates are automatically replaced when uploading new ones