openapi: 3.1.0
info:
  contact:
    email: dev@invopop.com
    name: Invopop Developers
  description: Set of end-points that help you test access to the Spain app API.
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  title: Spain Service API
  version: 0.1.0
servers:
  - description: production
    url: https://api.invopop.com
security:
  - InvopopAuth: []
paths:
  /apps/gov-es/v1/entry/{silo_entry_id}/{system}/agreement:
    get:
      x-mint:
        mcp:
          enabled: true
          name: get-gov-es-agreement
          description: >-
            Generate a PDF agreement of a previously prepared org.Party silo
            entry.
      description: Generate a PDF agreement of a previously prepared org.Party silo entry.
      parameters:
        - description: ID of the org.Party silo entry to generate the agreement for.
          in: path
          name: silo_entry_id
          required: true
          schema:
            description: ID of the org.Party silo entry to generate the agreement for.
            example: 5b45453c-cdd0-11ed-afa1-0242ac120002
            title: ID
            type: string
        - description: System in which the party is being registered.
          in: path
          name: system
          required: true
          schema:
            description: System in which the party is being registered.
            title: System
            type: string
            enum:
              - sii
      responses:
        '200':
          description: >-
            Successfully generated PDF of the agreement for the supplier or
            representative to sign.
          content:
            application/pdf:
              schema:
                type: string
                format: binary
        '422':
          description: Bad Request - Invalid input data.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    description: Details of the error.
        '500':
          description: Internal Server Error - Failed to generate PDF.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    description: Details of the error.
    post:
      description: Upload a signed copy of the PDF agreement.
      parameters:
        - description: ID of the org.Party silo entry to upload the agreement for.
          in: path
          name: silo_entry_id
          required: true
          schema:
            description: ID of the org.Party silo entry to upload the agreement for.
            example: 5b45453c-cdd0-11ed-afa1-0242ac120002
            title: ID
            type: string
        - description: System in which the party is being registered.
          in: path
          name: system
          required: true
          schema:
            description: System in which the party is being registered.
            title: System
            type: string
            enum:
              - sii
      requestBody:
        content:
          application/json:
            schema:
              properties:
                data:
                  description: >-
                    Base64 encoded binary data of the signed PDF agreement. Must
                    be

                    of type `application/pdf`.
                  format: byte
                  type: string
                signature:
                  description: >-
                    Type of signature used to sign the agreement. Use one of the
                    following options:
                      * `digital` - Signed using a digital certificate belonging to the supplier.
                      * `hand` - Physically signed by hand, and scanned.
                  type: string
                  enum:
                    - digital
                    - hand
              required:
                - data
                - signature
      responses:
        '202':
          description: No content
  /apps/gov-es/v1/entry/{silo_entry_id}/{system}/identity:
    post:
      description: Upload an image of an identity document.
      parameters:
        - description: ID of the org.Party silo entry to upload the identity for.
          in: path
          name: silo_entry_id
          required: true
          schema:
            description: ID of the org.Party silo entry to upload the identity for.
            example: 5b45453c-cdd0-11ed-afa1-0242ac120002
            title: ID
            type: string
        - description: System in which the party is being registered.
          in: path
          name: system
          required: true
          schema:
            description: System in which the party is being registered.
            title: System
            type: string
            enum:
              - sii
      requestBody:
        content:
          application/json:
            schema:
              properties:
                data:
                  description: |-
                    Base64 encoded binary data of the image. Must be
                    of type `image/jpeg` or `image/png`, with a maximum
                    file size of 10MB. The text of the image should be clearly
                    visible to be approved.
                  format: byte
                  type: string
                view:
                  description: |-
                    Point of view from which the image is taken. Pick one of the
                    options available:

                      - `front` - Front view of the identity card.
                      - `back`- Rear or back view of the identity card.
                      - `page` - Principal identity page of the document.
                  type: string
                  enum:
                    - front
                    - back
                    - page
              required:
                - data
                - view
      responses:
        '202':
          description: No content
  /apps/gov-es/v1/lookup:
    post:
      x-mint:
        mcp:
          enabled: true
          name: verify-gov-es-tax-id
          description: Verify a Spanish tax ID (NIF/CIF) against the AEAT census.
      description: |-
        Verify a Spanish tax ID (NIF/CIF) against the AEAT census. The endpoint
        always reports whether AEAT identified the tax ID. When `correct` is
        `true` and the tax ID is identified, the official name registered with
        AEAT is also returned.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                tax_id:
                  description: Spanish tax ID (NIF/CIF) to verify against AEAT.
                  type: string
                  example: B98602031
                name:
                  description: |-
                    Name to check against the tax ID. For individuals AEAT
                    verifies that the name matches the tax ID on record; for
                    companies the name is not required to confirm the tax ID
                    exists.
                  type: string
                  example: Provide One SL
                correct:
                  description: |-
                    When `true` and the tax ID is identified, the response also
                    includes the official `name` as registered with AEAT.
                  type: boolean
                  default: false
              required:
                - tax_id
      responses:
        '200':
          description: The verification completed and the result is reported in the body.
          content:
            application/json:
              schema:
                type: object
                properties:
                  identified:
                    description: Whether AEAT identified the tax ID.
                    type: boolean
                  name:
                    description: |-
                      Official name registered with AEAT. Only present when
                      `correct` was `true` in the request and the tax ID was
                      identified.
                    type: string
        '400':
          description: >-
            Bad Request - The request body could not be parsed or `tax_id` was
            empty.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    description: Details of the error.
        '422':
          description: >-
            Unprocessable Entity - The tax ID could not be verified (invalid or
            unverifiable input).
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    description: Details of the error.
        '500':
          description: Internal Server Error - The upstream AEAT lookup failed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    description: Details of the error.
  /apps/gov-es/v1/entry/{silo_entry_id}/{system}/confirm:
    post:
      description: Confirm that the upload process has completed.
      parameters:
        - description: ID of the org.Party silo entry to confirm the upload for.
          in: path
          name: silo_entry_id
          required: true
          schema:
            description: ID of the org.Party silo entry to confirm the upload for.
            example: 5b45453c-cdd0-11ed-afa1-0242ac120002
            title: ID
            type: string
        - description: System in which the party is being registered.
          in: path
          name: system
          required: true
          schema:
            description: System in which the party is being registered.
            title: System
            type: string
            enum:
              - sii
      responses:
        '202':
          description: No content
components:
  securitySchemes:
    InvopopAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: |
        Use the `Bearer` scheme with a valid JWT token to authenticate requests.

        Example: `Authorization: Bearer <token>`
