Skip to main content

Certificates

Upload and manage PKCS#12 signing certificates for fiscal authority communication. All endpoints require authentication.

Upload a certificate

POST /v1/certificates

Uploads a PKCS#12 certificate bundle. The certificate is validated, and metadata (subject, issuer, validity dates, NIF) is extracted automatically.

Request

Multipart form data:

FieldTypeRequiredDescription
certificatefileYesPKCS#12 (.p12/.pfx) file, max 10 MB
passwordstringYesPassword to decrypt the PKCS#12 bundle
certificate_idstringYesIdentifier for referencing in location config (alphanumeric, hyphens, underscores, dots)

Example

curl -X POST https://api.fiscalapi.com/v1/certificates \
-H "Authorization: Bearer fsk_test_abc123def456..." \
-F "certificate=@signing-cert.p12" \
-F "password=my-cert-password" \
-F "certificate_id=spain-prod-2026"

Response 201 Created

{
"id": "550e8400-e29b-41d4-a716-446655440000",
"certificate_id": "spain-prod-2026",
"subject_cn": "ACME CORP SL",
"issuer": "AC FNMT Usuarios",
"not_before": "2025-01-15T00:00:00Z",
"not_after": "2027-01-15T23:59:59Z",
"nif": "B12345674",
"created_at": "2026-03-09T12:00:00Z"
}

Errors

StatusErrorCause
400certificate_id is requiredMissing certificate_id field
400invalid certificate_id formatContains invalid characters
400password is requiredMissing password field
400failed to read certificate fileFile upload error
400failed to decode PKCS#12 bundleInvalid file or wrong password
409certificate with this ID already existsDuplicate certificate_id

List certificates

GET /v1/certificates

Returns all certificates for the authenticated account.

Example

curl https://api.fiscalapi.com/v1/certificates \
-H "Authorization: Bearer fsk_test_abc123def456..."

Response 200 OK

{
"data": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"certificate_id": "spain-prod-2026",
"subject_cn": "ACME CORP SL",
"issuer": "AC FNMT Usuarios",
"not_before": "2025-01-15T00:00:00Z",
"not_after": "2027-01-15T23:59:59Z",
"nif": "B12345674",
"created_at": "2026-03-09T12:00:00Z"
}
]
}

Delete a certificate

DELETE /v1/certificates/{id}

Deletes a certificate by its certificate_id.

Path parameters

ParameterTypeDescription
idstringThe certificate_id assigned during upload

Example

curl -X DELETE https://api.fiscalapi.com/v1/certificates/spain-prod-2026 \
-H "Authorization: Bearer fsk_test_abc123def456..."

Response 204 No Content

No response body.

Errors

StatusError
404certificate not found

Certificate metadata

FieldTypeDescription
iduuidInternal identifier
certificate_idstringUser-assigned identifier for referencing in location config
subject_cnstringCertificate subject common name
issuerstringCertificate issuer
not_beforedatetimeCertificate validity start
not_afterdatetimeCertificate validity end
nifstringTax ID extracted from certificate Subject.SerialNumber (IDCES-/VATES- pattern)
created_atdatetimeUpload timestamp

PKCS#12 format

FiscalAPI requires certificates in PKCS#12 format (.p12 or .pfx files). These bundles contain:

  • The signing certificate
  • The private key
  • Any intermediate CA certificates

Spanish tax authorities (AEAT, Basque regional authorities) issue certificates in this format. The certificate must contain a valid private key for signing fiscal documents.