> ## 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.

# Register Certificate

> Registers an existing certificate on a Blockchain network.



## OpenAPI

````yaml patch /certificates/{type}/{id}/register
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}/{id}/register:
    patch:
      tags:
        - Certificate Management
      summary: Register a certificate on a public network.
      parameters:
        - name: type
          in: path
          description: Type of the certificate identifier.
          required: true
          schema:
            type: string
            enum:
              - certID
              - externalId
              - fileHash
              - hash
        - name: id
          in: path
          description: Identifier of the certificate.
          required: true
          schema:
            type: string
            example: 1
        - name: networkId
          in: query
          description: Network identifier where the trustpoint will be registered.
          required: true
          schema:
            type: string
            example: 10004
      responses:
        '200':
          $ref: '#/components/responses/200-CertificateRegistered'
        '400':
          $ref: '#/components/responses/400-ValidationError'
        '401':
          $ref: '#/components/responses/401-AuthenticationError'
        '403':
          $ref: '#/components/responses/403-ForbiddenError'
        '404':
          $ref: '#/components/responses/404-NotFoundError'
        '429':
          $ref: '#/components/responses/429-OutOfCreditsError'
        '500':
          $ref: '#/components/responses/500-InternalServerError'
      security:
        - bearerAuth: []
components:
  responses:
    200-CertificateRegistered:
      description: Successful certificate registration.
      content:
        application/json:
          schema:
            type: object
            properties:
              statusCode:
                type: integer
                description: Request status code
                example: 200
              message:
                type: string
                description: Message returned by the request
                example: Certificate registered
              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
    404-NotFoundError:
      description: Not found error.
      content:
        application/json:
          schema:
            type: object
            properties:
              statusCode:
                type: integer
                description: Request status code.
                example: 404
              type:
                type: string
                description: Type of the error.
                example: Not Found Error
              message:
                type: string
                description: Message returned by the request.
                enum:
                  - Certificate with certId {certId} not found
                  - Certificate with externalId {externalId} not found
                  - Certificate with fileHash {fileHash} not found
    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

````