> ## Documentation Index
> Fetch the complete documentation index at: https://docs.factioapp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Validate Certificate

> Validate a .p12 certificate without persisting it.

Validates the certificate structure, extracts metadata, determines status,
and optionally cross-validates the certificate CN against the SRI legal
name for the given RUC.

This endpoint is designed for wizard flows where validation is needed before
final submission.

Args:
    file: .p12 certificate file
    password: Certificate password
    ruc: Optional RUC to cross-validate against certificate CN
    db: Async database session for SRI cache lookups

Returns:
    ValidateCertificateResponse: Validation result with metadata or error

Raises:
    HTTPException 422: If file cannot be read



## OpenAPI

````yaml /openapi.json post /issuers/certificates/validate
openapi: 3.1.0
info:
  title: Factio SRI API
  description: >-
    Plataforma headless, multi-tenant, API-first para emitir comprobantes
    electrónicos válidos ante el SRI de Ecuador.


    ## Autenticación


    Soporta tres métodos:

    - **JWT Bearer por Google OAuth**: `/auth/google/callback`

    - **JWT Bearer por email/password**: `/auth/login`

    - **API Key**: header `X-API-Key` con clave generada en `/auth/api-keys`


    ## Multi-tenant


    El aislamiento por tenant combina PostgreSQL RLS y validaciones explícitas
    en backend. El `tenant_id` se resuelve desde el contexto de autenticación.


    ## Flujo de Emisión


    1. `POST /documents` — reserva secuencial y encola el documento (responde
    202)

    2. `GET /documents/{id}` — consulta el estado actual por polling

    3. Cuando `status = AUTHORIZED`, el campo `authorization_number` contiene la
    clave de autorización del SRI


    Documentación completa en https://docs.factioapp.com
  version: 0.1.0
servers:
  - url: http://localhost:8000
    description: Local
  - url: https://api.factioapp.com
    description: Producción
  - url: https://api.staging.factioapp.com
    description: Sandbox (datos de prueba, sin efecto fiscal real)
security: []
paths:
  /issuers/certificates/validate:
    post:
      tags:
        - certificates
      summary: Validate Certificate
      description: >-
        Validate a .p12 certificate without persisting it.


        Validates the certificate structure, extracts metadata, determines
        status,

        and optionally cross-validates the certificate CN against the SRI legal

        name for the given RUC.


        This endpoint is designed for wizard flows where validation is needed
        before

        final submission.


        Args:
            file: .p12 certificate file
            password: Certificate password
            ruc: Optional RUC to cross-validate against certificate CN
            db: Async database session for SRI cache lookups

        Returns:
            ValidateCertificateResponse: Validation result with metadata or error

        Raises:
            HTTPException 422: If file cannot be read
      operationId: validate_certificate_issuers_certificates_validate_post
      parameters:
        - name: authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
        - name: x-api-key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Api-Key
        - name: x-tenant-id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Tenant-Id
        - name: factio_access_token
          in: cookie
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Factio Access Token
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: >-
                #/components/schemas/Body_validate_certificate_issuers_certificates_validate_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidateCertificateResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    Body_validate_certificate_issuers_certificates_validate_post:
      properties:
        file:
          type: string
          contentMediaType: application/octet-stream
          title: File
          description: .p12 certificate file
        password:
          type: string
          title: Password
          description: Certificate password
        ruc:
          anyOf:
            - type: string
            - type: 'null'
          title: Ruc
          description: RUC to cross-validate against certificate CN
      type: object
      required:
        - file
        - password
      title: Body_validate_certificate_issuers_certificates_validate_post
    ValidateCertificateResponse:
      properties:
        valid:
          type: boolean
          title: Valid
          description: Whether the certificate is valid
        subject_cn:
          anyOf:
            - type: string
            - type: 'null'
          title: Subject Cn
          description: Certificate subject common name
        serial_number:
          anyOf:
            - type: string
            - type: 'null'
          title: Serial Number
          description: Certificate serial number
        valid_from:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Valid From
          description: Certificate validity start date
        valid_until:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Valid Until
          description: Certificate validity end date
        status:
          anyOf:
            - type: string
            - type: 'null'
          title: Status
          description: 'Certificate status: active, expiring, expired'
        error_detail:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Detail
          description: Error message if validation failed
      type: object
      required:
        - valid
      title: ValidateCertificateResponse
      description: Response for certificate validation without persistence.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````