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

# Create File Certificate

> Creates a certificate from a file.



## OpenAPI

````yaml post /certificates?type=file
openapi: 3.0.1
info:
  title: TrustOS EVM Cert API
  description: >-
    TrustOS EVM Cert API is used to interact with EVM based blockchain networks.
    In case you have some questions or need more about the use of this API,
    don't hesitate to contact B-Team:
  contact:
    name: Blockchain Team
    email: soporte-bteam@telefonica.com
  version: 2.6.0
servers:
  - url: https://lab.trustos.telefonicatech.com/cert/v2
    description: Lab
security: []
tags:
  - name: Certificate Generation
    description: Methods for generating certificates.
  - name: Certificate Management
    description: Basic methods about certificates.
  - name: Qualified Signature
    description: Methods for generating qualified signatures.
  - name: Utils
    description: Methods for specific use cases.
paths:
  /certificates?type=file:
    post:
      tags:
        - Certificate Generation
      summary: Create a certificate from a file.
      parameters:
        - name: qualified
          in: query
          description: >-
            Flag that indicates whether the certificate should be qualified
            sign.
          required: false
          schema:
            type: boolean
            enum:
              - true
              - false
        - name: publish
          in: query
          description: >-
            Flag that indicates if the file should be published in the file
            repository. Public files are accessible by anyone with the file's
            URL. Handle with caution to avoid unintended data exposure.
          required: false
          schema:
            type: boolean
            enum:
              - true
              - false
        - name: networkId
          in: query
          description: Network identifier where the trustpoint will be registered.
          required: true
          schema:
            type: string
            example: 10004
      requestBody:
        description: Data needed for the creation of a certificate from a file.
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                fileInput:
                  type: string
                  format: binary
                  description: File which will be hashed and certified.
                body:
                  type: object
                  properties:
                    name:
                      type: string
                      description: Name of the certificate.
                      example: Certificate
                    description:
                      type: string
                      description: Description of the certificate.
                      example: Certificate description
                    content:
                      type: object
                      description: Additional content properties of the certificate.
                      example: {}
                    public:
                      type: boolean
                      description: >-
                        Flag that indicates whether the certificate is public or
                        not.
                      enum:
                        - true
                        - false
                    expires:
                      type: number
                      description: Timestamp of the expiration date of the certificate.
                      example: 1234567890
                    certificatePin:
                      type: string
                      description: PIN of the certificate.
                      example: '1234'
                    externalId:
                      type: string
                      description: Custom identifier of the certificate.
                      example: extcertid
                  required:
                    - name
                    - description
              required:
                - fileInput
                - body
      responses:
        '201':
          $ref: '#/components/responses/201-CertificateCreated'
        '400':
          $ref: '#/components/responses/400-ValidationError'
        '401':
          $ref: '#/components/responses/401-AuthenticationError'
        '403':
          $ref: '#/components/responses/403-ForbiddenError'
        '409':
          $ref: '#/components/responses/409-ExistingCertificateError'
        '429':
          $ref: '#/components/responses/429-OutOfCreditsError'
        '500':
          $ref: '#/components/responses/500-InternalServerError'
      security:
        - bearerAuth: []
components:
  responses:
    201-CertificateCreated:
      description: Successful certificate creation.
      content:
        application/json:
          schema:
            type: object
            properties:
              statusCode:
                type: integer
                description: Request status code.
                example: 201
              message:
                type: string
                description: Message returned by the request.
                example: Certificate created
              data:
                $ref: '#/components/schemas/CertModel'
                type: object
                description: Data returned by the request.
    400-ValidationError:
      description: Validation error.
      content:
        application/json:
          schema:
            type: object
            properties:
              statusCode:
                type: number
                description: Request status code.
                example: 400
              type:
                type: string
                description: Type of the error.
                example: Validation Error
              message:
                type: string
                description: Message returned by the request.
                example: Request parameters are wrong, check requirements
              errors:
                type: array
                description: All the validation errors encountered in the request.
                items:
                  type: object
                  properties:
                    field:
                      type: string
                      description: Name of the field.
                      example: ''
                    error:
                      type: string
                      description: Description of the error encountered.
                      example: ''
    401-AuthenticationError:
      description: Authentication error.
      content:
        application/json:
          schema:
            type: object
            properties:
              statusCode:
                type: number
                description: Request status code.
                example: 401
              type:
                type: string
                description: Type of the error.
                example: Authentication Error
              message:
                type: string
                description: Message returned by the request.
                enum:
                  - User credentials are wrong
                  - Token is invalid
                  - Token is expired
                  - Token is not provided
    403-ForbiddenError:
      description: Forbidden error.
      content:
        application/json:
          schema:
            type: object
            properties:
              statusCode:
                type: number
                description: Request status code.
                example: 403
              type:
                type: string
                description: Type of the error.
                example: Forbidden Error
              message:
                type: string
                description: Message returned by the request.
                enum:
                  - >-
                    User is not qualified, please try again with a qualified
                    user
                  - This certificate requires a PIN, please provide it
                  - >-
                    Provider not available in your plan. Please, contact B-Team
                    to include it
    409-ExistingCertificateError:
      description: Existing certificate error.
      content:
        application/json:
          schema:
            type: object
            properties:
              statusCode:
                type: number
                description: Request status code.
                example: 409
              type:
                type: string
                description: Type of the error.
                example: Existing certificate error
              message:
                type: string
                description: Message returned by the request.
                enum:
                  - >-
                    The certificate is already registered, please try again with
                    a different content
                  - >-
                    The provided externalId is already registered, please try
                    again with a different one
    429-OutOfCreditsError:
      description: Out of credits error.
      content:
        application/json:
          schema:
            type: object
            properties:
              statusCode:
                type: number
                description: Request status code.
                example: 429
              type:
                type: string
                description: Type of the error.
                example: Out of Credits Error
              message:
                type: string
                description: Message returned by the request.
                example: >-
                  User has run out of credits. Please, contact BTeam to increase
                  the limit
    500-InternalServerError:
      description: Internal server error.
      content:
        application/json:
          schema:
            type: object
            properties:
              statusCode:
                type: number
                description: Request status code.
                example: 500
              type:
                type: string
                description: Type of the error.
                example: Internal Server Error
              message:
                type: string
                description: Message returned by the request.
                example: Oops! Something went wrong, please try again later
  schemas:
    CertModel:
      type: object
      properties:
        certID:
          type: string
          description: Identifier of the certificate.
          example: did:local:certid:123124
        data:
          type: object
          properties:
            name:
              type: string
              description: Name of the certificate.
              example: Certificate
            description:
              type: string
              description: Description of the certificate.
              example: Certificate description
            type:
              type: string
              description: Type of the certificate.
              enum:
                - content
                - file
                - asset
                - url
            content:
              type: object
              description: Content of the certificate.
              example: {}
            issuer:
              type: string
              description: Identifier of the user who created the certificate.
              example: did:user:{issuer}
            issuedOn:
              type: integer
              description: Timestamp of the certificate creation.
              example: 1696840286580
            hash:
              type: string
              description: Hash of the certificate.
              example: a2ac9343a3d94e41bbc5c152fb8382c5233a47cee23cf765c7e6d67d9e61a142
            expires:
              type: integer
              description: Timestamp of the certificate expiration.
              example: 1696840286580
        metadata:
          type: array
          description: Metadata related to the certificate TrustPoints.
          items:
            type: object
            properties:
              type:
                type: string
                description: Type of the metadata item.
                enum:
                  - Evidence
                  - Revocation
                  - Signature
              networkId:
                type: string
                description: Network identifier where the evidence was registered.
                example: 10004
              smartContract:
                type: string
                description: Smart contract address where the evidence was registered.
                example: '0xabcdbcbff5fa05e060e7dfe3e608cba010d11abc'
              transactionHash:
                type: string
                description: Identifier of the transaction in the Blockchain network.
                example: '0xabcdbcbff5fa05e060e7dfe3e608cba010d11abc'
              trustPointHash:
                type: string
                description: >-
                  Double hash of the evidence, registered in the Blockchain
                  network.
                example: >-
                  a2ac9343a3d94e41bbc5c152fb8382c5233a47cee23cf765c7e6d67d9e61a142
              timestamp:
                type: integer
                description: Timestamp of the metadata item.
                example: 1696840286580
        access:
          type: object
          description: Access information of the certificate.
          properties:
            public:
              type: boolean
              description: Flag that indicates whether the certificate is public or not.
              enum:
                - true
                - false
            certificatePin:
              type: string
              description: Encrypted PIN of the certificate.
              example: '1234'
            externalId:
              type: string
              description: Custom identifier of the certificate.
              example: extcertid
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````