curl --request POST \
--url http://localhost:8000/issuers/{issuer_id}/certificates \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file' \
--form 'password=<string>'import requests
url = "http://localhost:8000/issuers/{issuer_id}/certificates"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = { "password": "<string>" }
response = requests.post(url, data=payload, files=files)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('password', '<string>');
const options = {method: 'POST'};
options.body = form;
fetch('http://localhost:8000/issuers/{issuer_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_PORT => "8000",
CURLOPT_URL => "http://localhost:8000/issuers/{issuer_id}/certificates",
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=\"password\"\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 := "http://localhost:8000/issuers/{issuer_id}/certificates"
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=\"password\"\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("http://localhost:8000/issuers/{issuer_id}/certificates")
.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=\"password\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8000/issuers/{issuer_id}/certificates")
http = Net::HTTP.new(url.host, url.port)
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=\"password\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"created_at": "2024-01-01T00:00:00Z",
"id": "990e8400-e29b-41d4-a716-446655440000",
"issuer_id": "550e8400-e29b-41d4-a716-446655440000",
"serial_number": "1234567890ABCDEF",
"status": "active",
"subject_cn": "EMPRESA EJEMPLO S.A.",
"tenant_id": "660e8400-e29b-41d4-a716-446655440000",
"updated_at": "2024-01-01T00:00:00Z",
"valid_from": "2024-01-01T00:00:00Z",
"valid_until": "2026-01-01T00:00:00Z"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Upload Certificate
Upload a new .p12 certificate for an Issuer.
Validates the certificate, extracts metadata, uploads the encrypted file to object storage, stores the password in Secret Manager, and creates a certificate record in the database.
All database operations use async/await for non-blocking I/O.
Args: issuer_id: UUID of the parent issuer file: .p12 certificate file password: Certificate password db: Async database session tenant_id: Active tenant ID from authentication context user_id: Current user ID for auditing
Returns: CertificateResponse: Created certificate data (without sensitive info)
Raises: HTTPException 404: If issuer not found or doesn’t belong to tenant HTTPException 422: If certificate is invalid or validation fails
curl --request POST \
--url http://localhost:8000/issuers/{issuer_id}/certificates \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file' \
--form 'password=<string>'import requests
url = "http://localhost:8000/issuers/{issuer_id}/certificates"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = { "password": "<string>" }
response = requests.post(url, data=payload, files=files)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('password', '<string>');
const options = {method: 'POST'};
options.body = form;
fetch('http://localhost:8000/issuers/{issuer_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_PORT => "8000",
CURLOPT_URL => "http://localhost:8000/issuers/{issuer_id}/certificates",
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=\"password\"\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 := "http://localhost:8000/issuers/{issuer_id}/certificates"
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=\"password\"\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("http://localhost:8000/issuers/{issuer_id}/certificates")
.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=\"password\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8000/issuers/{issuer_id}/certificates")
http = Net::HTTP.new(url.host, url.port)
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=\"password\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"created_at": "2024-01-01T00:00:00Z",
"id": "990e8400-e29b-41d4-a716-446655440000",
"issuer_id": "550e8400-e29b-41d4-a716-446655440000",
"serial_number": "1234567890ABCDEF",
"status": "active",
"subject_cn": "EMPRESA EJEMPLO S.A.",
"tenant_id": "660e8400-e29b-41d4-a716-446655440000",
"updated_at": "2024-01-01T00:00:00Z",
"valid_from": "2024-01-01T00:00:00Z",
"valid_until": "2026-01-01T00:00:00Z"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Path Parameters
Cookies
Body
Response
Successful Response
Schema for Certificate response (without sensitive data).
Status values for digital certificates.
uploaded, active, expiring, expired, revoked, disabled