openapi: 3.1.0
info:
  title: Trusted Certificate API
  description: REST API for managing Trusted Certificates in the platform
  contact:
    name: ILM
    url: https://www.otilm.com
    email: ilm@omnitrust.com
  license:
    name: "Apache License, Version 2.0"
    url: https://github.com/OmniTrustILM/interface-documentation/blob/main/LICENSE.md
  version: 2.20.0
  x-logo:
    url: images/ilm-logo.svg
externalDocs:
  description: ILM Documentation
  url: https://docs.otilm.com
servers:
- url: https://demo.otilm.com/api
  description: ILM Demo server
tags:
- name: Trusted Certificate Management
  description: Trusted Certificate Management API
paths:
  /v1/trustedCertificates:
    get:
      tags:
      - Trusted Certificate Management
      summary: List Trusted Certificates
      operationId: listTrustedCertificates
      responses:
        "200":
          description: List of Trusted Certificates
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/TrustedCertificateDto"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorMessageDto"
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AuthenticationServiceExceptionDto"
        "500":
          description: Internal Server Error
        "404":
          description: Not Found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorMessageDto"
      security:
      - SessionAuth: []
      - CertificateAuth: []
      - BearerJWTAuth: []
    post:
      tags:
      - Trusted Certificate Management
      summary: Create a new Trusted Certificate
      operationId: createTrustedCertificate
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TrustedCertificateRequestDto"
        required: true
      responses:
        "201":
          description: New Trusted Certificate created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UuidDto"
        "422":
          description: Unprocessable Content
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
              example:
              - Error Message 1
              - Error Message 2
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorMessageDto"
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AuthenticationServiceExceptionDto"
        "500":
          description: Internal Server Error
        "404":
          description: Not Found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorMessageDto"
      security:
      - SessionAuth: []
      - CertificateAuth: []
      - BearerJWTAuth: []
  /v1/trustedCertificates/{uuid}:
    get:
      tags:
      - Trusted Certificate Management
      summary: Get details of a Trusted Certificate
      operationId: getTrustedCertificate
      parameters:
      - name: uuid
        in: path
        description: Trusted Certificate UUID
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Trusted Certificate details retrieved
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TrustedCertificateDto"
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorMessageDto"
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AuthenticationServiceExceptionDto"
        "500":
          description: Internal Server Error
        "404":
          description: Not Found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorMessageDto"
      security:
      - SessionAuth: []
      - CertificateAuth: []
      - BearerJWTAuth: []
    delete:
      tags:
      - Trusted Certificate Management
      summary: Delete a Trusted Certificate
      operationId: deleteTrustedCertificate
      parameters:
      - name: uuid
        in: path
        description: Trusted Certificate UUID
        required: true
        schema:
          type: string
      responses:
        "204":
          description: Trusted Certificate deleted
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorMessageDto"
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AuthenticationServiceExceptionDto"
        "500":
          description: Internal Server Error
        "404":
          description: Not Found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorMessageDto"
      security:
      - SessionAuth: []
      - CertificateAuth: []
      - BearerJWTAuth: []
components:
  schemas:
    TrustedCertificateRequestDto:
      type: object
      properties:
        certificateContent:
          type: string
          format: byte
          description: Raw certificate content serialized as Base64 String in JSON
      required:
      - certificateContent
    UuidDto:
      type: object
      properties:
        uuid:
          type: string
          description: Object identifier
      required:
      - uuid
    ErrorMessageDto:
      type: object
      properties:
        message:
          type: string
          description: Error message detail
          examples:
          - Error message
      required:
      - message
    AuthenticationServiceExceptionDto:
      type: object
      properties:
        statusCode:
          type: integer
          format: int32
          description: Status code of the HTTP Request
        code:
          type: string
          description: Code of the result
        message:
          type: string
          description: Exception message
      required:
      - code
      - message
      - statusCode
    TrustedCertificateDto:
      type: object
      properties:
        uuid:
          type: string
          description: UUID of the Trusted Certificate
        certificateContent:
          type: string
          format: byte
          description: Raw certificate content serialized as Base64 String in JSON
        issuer:
          type: string
          description: Certificate issuer DN
        san:
          type: string
          description: Subject alternative names
        serialNumber:
          type: string
          description: Certificate serial number
        subject:
          type: string
          description: Certificate subject DN
        thumbprint:
          type: string
          description: Certificate thumbprint (fingerprint)
        notBefore:
          type: string
          format: date-time
          description: Certificate validity start date
        notAfter:
          type: string
          format: date-time
          description: Certificate expiration date
      required:
      - certificateContent
      - uuid
  securitySchemes:
    SessionAuth:
      type: apiKey
      description: Session-based authentication with session ID stored in 'session-id'
        cookie
      name: session-id
      in: cookie
    CertificateAuth:
      type: apiKey
      description: Base64 encoded X.509 certificate passed in header
      name: ssl-client-cert
      in: header
    BearerJWTAuth:
      type: http
      scheme: Bearer
      bearerFormat: JWT
