openapi: 3.0.3
info:
  title: PDND Interoperability API
  x-summary: PDND Interoperability API
  version: "2.0.0"
  contact:
    name: API Support
    url: "https://github.com/pagopa/pdnd-interop-frontend/issues"
  termsOfService: "https://selfcare.interop.pagopa.it/ui/it/termini-di-servizio"
servers:
  - url: "https://api.interop.pagopa.it/v2"
    description: Production environment
security:
  - bearerAuth: []
tags:
  - name: clients
    description: Clients routes
    externalDocs:
      description: Find out more
      url: "http://swagger.io"
  - name: attributes
    description: Attributes routes
    externalDocs:
      description: Find out more
      url: "http://swagger.io"
  - name: agreements
    description: Agreements routes
    externalDocs:
      description: Find out more
      url: "http://swagger.io"
  - name: eservices
    description: E-Services routes
    externalDocs:
      description: Find out more
      url: "http://swagger.io"
  - name: keys
    description: Keys routes
    externalDocs:
      description: Find out more
      url: "http://swagger.io"
  - name: purposes
    description: Purposes routes
    externalDocs:
      description: Find out more
      url: "http://swagger.io"
  - name: tenants
    description: Tenants routes
    externalDocs:
      description: Find out more
      url: "http://swagger.io"
  - name: delegations
    description: Delegations routes
    externalDocs:
      description: Find out more
      url: "http://swagger.io"
  - name: eserviceTemplates
    description: E-Service Templates routes
    externalDocs:
      description: Find out more
      url: "http://swagger.io"
  - name: health
    description: Verify service status
    externalDocs:
      description: Find out more
      url: "http://swagger.io"
paths:
  /agreements:
    get:
      tags:
        - agreements
      summary: List Agreements
      description: Retrieve a list of Agreements based on filters
      operationId: getAgreements
      parameters:
        - in: query
          name: states
          description: Filter Agreements by states. If not specified, return Agreements in any state
          required: false
          schema:
            type: array
            items:
              $ref: "#/components/schemas/AgreementState"
            default: []
          explode: false
        - in: query
          name: producerIds
          description: Filter Agreements by producer IDs. If not specified, return Agreements for any producer
          required: false
          schema:
            type: array
            items:
              type: string
              format: uuid
            default: []
          explode: false
        - in: query
          name: consumerIds
          description: Filter Agreements by consumer IDs. If not specified, return Agreements for any consumer
          required: false
          schema:
            type: array
            items:
              type: string
              format: uuid
            default: []
          explode: false
        - in: query
          name: eserviceIds
          description: Filter Agreements by E-Service IDs. If not specified, return Agreements for any E-Service
          schema:
            type: array
            items:
              type: string
              format: uuid
            default: []
          explode: false
        - in: query
          name: offset
          description: Pagination starting position
          required: true
          schema:
            type: integer
            format: int32
            minimum: 0
        - in: query
          name: limit
          description: Maximum number of results to return
          required: true
          schema:
            type: integer
            format: int32
            minimum: 1
            maximum: 50
      responses:
        "200":
          description: Agreements retrieved
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Agreements"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
    post:
      tags:
        - agreements
      summary: Create a new Agreement
      description: Create a new Agreement in Draft state
      operationId: createAgreement
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AgreementSeed"
        required: true
      responses:
        "201":
          description: Agreement created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Agreement"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "403":
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "409":
          description: Conflict
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /agreements/{agreementId}:
    parameters:
      - name: agreementId
        in: path
        description: The ID of the Agreement to retrieve
        required: true
        schema:
          type: string
          format: uuid
    get:
      tags:
        - agreements
      summary: Retrieve an Agreement
      description: Retrieve an Agreement
      operationId: getAgreement
      responses:
        "200":
          description: Agreement retrieved
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Agreement"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "403":
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /agreements/{agreementId}/approve:
    parameters:
      - schema:
          type: string
          format: uuid
        name: agreementId
        description: The ID of the Agreement to approve
        in: path
        required: true
    post:
      tags:
        - agreements
      summary: Approve an Agreement in Pending state
      description: Approve an Agreement that is in Pending state, transitioning it to Active state
      operationId: approveAgreement
      responses:
        "200":
          description: Agreement approved
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Agreement"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "403":
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "409":
          description: Conflict
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /agreements/{agreementId}/reject:
    parameters:
      - schema:
          type: string
          format: uuid
        name: agreementId
        description: The ID of the Agreement to reject
        in: path
        required: true
    post:
      tags:
        - agreements
      summary: Reject an Agreement in Pending state
      description: Reject an Agreement that is in Pending state, transitioning it to Rejected state
      operationId: rejectAgreement
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AgreementRejection"
        required: true
      responses:
        "200":
          description: Agreement rejected
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Agreement"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "403":
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /agreements/{agreementId}/submit:
    parameters:
      - schema:
          type: string
          format: uuid
        name: agreementId
        description: The ID of the Agreement to submit
        in: path
        required: true
    post:
      tags:
        - agreements
      summary: Submit an Agreement in Draft state
      description: Submit an Agreement that is in Draft state, transitioning it to Active state if all requirements are satisfied, to Pending otherwise
      operationId: submitAgreement
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AgreementSubmission"
        description: payload for agreement submission
        required: true
      responses:
        "200":
          description: Draft agreement submitted
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Agreement"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "403":
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "409":
          description: Conflict
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /agreements/{agreementId}/suspend:
    parameters:
      - schema:
          type: string
          format: uuid
        name: agreementId
        description: The ID of the Agreement to suspend
        in: path
        required: true
    post:
      tags:
        - agreements
      summary: Suspend an Agreement in Active or Suspended state
      description: |
        Suspend an Agreement that is in Active or Suspended state, transitioning it to Suspended state
        An Agreement may already be in Suspended state when previously suspended by the consumer or the producer
      operationId: suspendAgreement
      responses:
        "200":
          description: Active agreement suspended
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Agreement"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "403":
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /agreements/{agreementId}/unsuspend:
    parameters:
      - schema:
          type: string
          format: uuid
        name: agreementId
        description: The ID of the Agreement to unsuspend
        in: path
        required: true
    post:
      tags:
        - agreements
      summary: Unsuspend an Agreement in Suspended state
      description: |
        Unsuspend an Agreement that is in Suspended state, transitioning it to Active or Suspended state
        An Agreement may remain in Suspended state when suspended also by the consumer or the producer
      operationId: unsuspendAgreement
      responses:
        "200":
          description: Agreement unsuspended
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Agreement"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "403":
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /agreements/{agreementId}/upgrade:
    parameters:
      - name: agreementId
        in: path
        description: The ID of the Agreement to upgrade
        required: true
        schema:
          type: string
          format: uuid
    post:
      tags:
        - agreements
      summary: Upgrade an Agreement
      description: |
        Upgrade the Agreement to a newer E-Service version, if available
        The current Agreement will be archived and a new Agreement will be created, in the same state
      operationId: upgradeAgreement
      responses:
        "200":
          description: Agreement updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Agreement"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "403":
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /consumerDelegations:
    get:
      tags:
        - delegations
      summary: List Consumer Delegations
      description: Retrieve a list of Consumer Delegations based on filters
      operationId: getConsumerDelegations
      parameters:
        - in: query
          name: states
          description: Filter Consumer Delegations by states. If not specified, return Consumer Delegations in any state
          required: false
          schema:
            type: array
            items:
              $ref: "#/components/schemas/DelegationState"
            default: []
          explode: false
        - in: query
          name: delegatorIds
          description: Filter Consumer Delegations by delegator IDs. If not specified, return Consumer Delegations for any delegator
          required: false
          schema:
            type: array
            items:
              type: string
              format: uuid
            default: []
          explode: false
        - in: query
          name: delegateIds
          description: Filter Consumer Delegations by delegate IDs. If not specified, return Consumer Delegations for any delegate
          required: false
          schema:
            type: array
            items:
              type: string
              format: uuid
            default: []
          explode: false
        - in: query
          name: eserviceIds
          description: Filter Consumer Delegations by E-Service IDs. If not specified, return Consumer Delegations for any E-Service
          schema:
            type: array
            items:
              type: string
              format: uuid
            default: []
          explode: false
        - in: query
          name: offset
          description: Pagination starting position
          required: true
          schema:
            type: integer
            format: int32
            minimum: 0
        - in: query
          name: limit
          description: Maximum number of results to return
          required: true
          schema:
            type: integer
            format: int32
            minimum: 1
            maximum: 50
      responses:
        "200":
          description: Consumer Delegations retrieved
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConsumerDelegations"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
    post:
      tags:
        - delegations
      summary: Create a new Consumer Delegation
      description: Create a new Consumer Delegation in Waiting for Approval state
      operationId: createConsumerDelegation
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DelegationSeed"
        required: true
      responses:
        "201":
          description: Consumer Delegation created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConsumerDelegation"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "403":
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "409":
          description: Conflict
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /consumerDelegations/{delegationId}/accept:
    parameters:
      - name: delegationId
        in: path
        description: The ID of the Consumer Delegation to accept
        required: true
        schema:
          type: string
          format: uuid
    post:
      tags:
        - delegations
      summary: Accept a Consumer Delegation in Waiting for Approval state
      description: Accept a Consumer Delegation that is in Waiting for Approval state, transitioning it to Active state
      operationId: acceptConsumerDelegation
      responses:
        "200":
          description: Consumer Delegation accepted
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConsumerDelegation"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "403":
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "409":
          description: Conflict
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /certifiedAttributes:
    post:
      tags:
        - attributes
      summary: Create a certified Attribute
      description: |
        Create a certified Attribute
        The Attribute must
          - have a unique name across all Attributes in the Platform
          - have a unique code across certified Attributes owned by the requester
      operationId: createCertifiedAttribute
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CertifiedAttributeSeed"
      responses:
        "201":
          description: Certified Attribute created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CertifiedAttribute"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "403":
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "409":
          description: Conflict
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /certifiedAttributes/{attributeId}:
    parameters:
      - name: attributeId
        in: path
        description: The ID of the Attribute to retrieve
        required: true
        schema:
          type: string
          format: uuid
    get:
      tags:
        - attributes
      summary: Retrieve a certified Attribute
      description: Retrieve a certified Attribute
      operationId: getCertifiedAttribute
      responses:
        "200":
          description: Certified attribute retrieved
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CertifiedAttribute"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /clients/{clientId}/purposes:
    parameters:
      - name: clientId
        in: path
        description: The ID of the Client to link the Purpose to
        required: true
        schema:
          type: string
          format: uuid
    post:
      tags:
        - clients
      summary: Link a Client to a Purpose
      description: |
        Link a Client to a Purpose
        The Purpose must be in Active or Suspended state
      operationId: addClientPurpose
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ClientAddPurpose"
        required: true
      responses:
        "204":
          description: Client linked to the Purpose
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "403":
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "409":
          description: Conflict
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /consumerDelegations/{delegationId}/reject:
    parameters:
      - name: delegationId
        in: path
        description: The ID of the Consumer Delegation to reject
        required: true
        schema:
          type: string
          format: uuid
    post:
      tags:
        - delegations
      summary: Reject a Consumer Delegation in Waiting for Approval state
      description: Reject a Consumer Delegation that is in Waiting for Approval state, transitioning it to Rejected state
      operationId: rejectConsumerDelegation
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DelegationRejection"
        required: true
        description: Payload for delegation rejection
      responses:
        "200":
          description: Consumer Delegation rejected
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ConsumerDelegation"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "403":
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /eservices:
    get:
      tags:
        - eservices
      summary: List E-Services
      description: Retrieve a list of E-Services based on filters
      operationId: getEServices
      parameters:
        - in: query
          name: producerIds
          description: Filter E-Services by producer IDs. If not specified, return E-Services for any producer
          schema:
            type: array
            items:
              type: string
              format: uuid
            default: []
          explode: false
        - in: query
          name: templateIds
          description: Filter E-Services by template IDs. If not specified, return E-Services for any template, and E-Services without a template
          schema:
            type: array
            items:
              type: string
              format: uuid
            default: []
          explode: false
        - in: query
          name: offset
          description: Pagination starting position
          required: true
          schema:
            type: integer
            format: int32
            minimum: 0
        - in: query
          name: limit
          description: Maximum number of results to return
          required: true
          schema:
            type: integer
            format: int32
            minimum: 1
            maximum: 50
      responses:
        "200":
          description: E-Services retrieved
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/EServices"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /eservices/{eserviceId}:
    parameters:
      - name: eserviceId
        in: path
        description: The E-Service ID
        required: true
        schema:
          type: string
          format: uuid
    get:
      tags:
        - eservices
      summary: Retrieve an E-Service
      description: Retrieve an E-Service
      operationId: getEService
      responses:
        "200":
          description: E-Service retrieved
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/EService"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /eservices/{eserviceId}/descriptors:
    parameters:
      - name: eserviceId
        in: path
        description: The E-Service ID of the Descriptors to retrieve
        required: true
        schema:
          type: string
          format: uuid
    get:
      tags:
        - eservices
      summary: List E-Service Descriptors
      description: Retrieve a list of E-Service Descriptors based on filters
      operationId: getEServiceDescriptors
      parameters:
        - name: state
          in: query
          description: Filter Descriptors by states. If not specified, return Descriptors in any state
          schema:
            $ref: "#/components/schemas/EServiceDescriptorState"
        - in: query
          name: offset
          description: Pagination starting position
          required: true
          schema:
            type: integer
            format: int32
            minimum: 0
        - in: query
          name: limit
          description: Maximum number of results to return
          required: true
          schema:
            type: integer
            format: int32
            minimum: 1
            maximum: 50
      responses:
        "200":
          description: E-Service Descriptors retrieved
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/EServiceDescriptors"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /eservices/{eserviceId}/descriptors/{descriptorId}:
    parameters:
      - name: eserviceId
        in: path
        description: The E-Service ID of the Descriptor
        required: true
        schema:
          type: string
          format: uuid
      - name: descriptorId
        in: path
        description: The ID of the Descriptor to retrieve
        required: true
        schema:
          type: string
          format: uuid
    get:
      tags:
        - eservices
      summary: Retrieve an E-Service Descriptor
      description: Retrieve an E-Service Descriptor
      operationId: getEServiceDescriptor
      responses:
        "200":
          description: E-Service Descriptor retrieved
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/EServiceDescriptor"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /eserviceTemplates/{templateId}:
    parameters:
      - name: templateId
        in: path
        description: The template id
        required: true
        schema:
          type: string
          format: uuid
    get:
      tags:
        - eserviceTemplates
      summary: Retrieve an E-Service Template
      description: Retrieve an E-Service Template
      operationId: getEServiceTemplate
      responses:
        "200":
          description: E-Service Template retrieved
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/EServiceTemplate"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /eserviceTemplates/{templateId}/versions:
    parameters:
      - name: templateId
        in: path
        description: The E-Service Template ID of the Versions to retrieve
        required: true
        schema:
          type: string
          format: uuid
    get:
      tags:
        - eserviceTemplates
      summary: List E-Service Template Versions
      description: Retrieve a list of E-Service Template Versions based on filters
      operationId: getEServiceTemplateVersions
      parameters:
        - name: state
          in: query
          description: Filter Versions by states. If not specified, return Versions in any state
          schema:
            $ref: "#/components/schemas/EServiceTemplateVersionState"
        - in: query
          name: offset
          description: Pagination starting position
          required: true
          schema:
            type: integer
            format: int32
            minimum: 0
        - in: query
          name: limit
          description: Maximum number of results to return
          required: true
          schema:
            type: integer
            format: int32
            minimum: 1
            maximum: 50
      responses:
        "200":
          description: E-Service Template Versions retrieved
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/EServiceTemplateVersions"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /eserviceTemplates/{templateId}/versions/{versionId}:
    parameters:
      - name: templateId
        in: path
        description: The E-Service Template ID of the Version
        required: true
        schema:
          type: string
          format: uuid
      - name: versionId
        in: path
        description: The ID of the Version to retrieve
        required: true
        schema:
          type: string
          format: uuid
    get:
      tags:
        - eserviceTemplates
      summary: Retrieve an E-Service Template Version
      description: Retrieve an E-Service Template Version
      operationId: getEServiceTemplateVersion
      responses:
        "200":
          description: E-Service Template Version retrieved
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/EServiceTemplateVersion"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /keys/{kid}:
    get:
      tags:
        - keys
      summary: Retrieve a Key in JWK format
      description: Retrieve the JWK by kid
      operationId: getJWKByKid
      parameters:
        - name: kid
          in: path
          description: The unique identifier of the Key (kid)
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Key retrieved
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Key"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
        "404":
          description: Key not found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /producerKeys/{kid}:
    get:
      tags:
        - keys
      summary: Retrieve a Producer Key in JWK format
      description: Retrieve the Producer JWK by kid
      operationId: getProducerJWKByKid
      parameters:
        - name: kid
          in: path
          description: The unique identifier of the Producer Key (kid)
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Producer Key retrieved
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProducerKey"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
        "404":
          description: Producer Key not found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /purposes:
    post:
      tags:
        - purposes
      summary: Create a new Purpose
      description: Create a new Purpose in Draft state
      operationId: createPurpose
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PurposeSeed"
        required: true
      responses:
        "201":
          description: Purpose created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Purpose"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "403":
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "409":
          description: Name Conflict
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
    get:
      tags:
        - purposes
      summary: List Purposes
      description: Retrieve a list of Purposes based on filters
      operationId: getPurposes
      parameters:
        - in: query
          name: eserviceIds
          description: Filter Purposes by E-Service IDs. If not specified, return Purposes for any E-Service
          schema:
            type: array
            items:
              type: string
              format: uuid
            default: []
          explode: false
        - in: query
          name: offset
          description: Pagination starting position
          required: true
          schema:
            type: integer
            format: int32
            minimum: 0
        - in: query
          name: limit
          description: Maximum number of results to return
          required: true
          schema:
            type: integer
            format: int32
            minimum: 1
            maximum: 50
      responses:
        "200":
          description: Purposes retrieved
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Purposes"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /purposes/{purposeId}:
    parameters:
      - name: purposeId
        in: path
        description: The ID of the Purpose to retrieve
        required: true
        schema:
          type: string
          format: uuid
    get:
      tags:
        - purposes
      summary: Retrieve a Purpose
      description: Retrieve a Purpose
      operationId: getPurpose
      responses:
        "200":
          description: Purpose retrieved
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Purpose"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "403":
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /purposes/{purposeId}/versions:
    parameters:
      - name: purposeId
        in: path
        description: The Purpose ID of the Versions to retrieve
        required: true
        schema:
          type: string
    get:
      tags:
        - purposes
      summary: List Purpose Versions
      description: Retrieve a list of Purpose Versions based on filters
      operationId: getPurposeVersions
      parameters:
        - name: state
          in: query
          description: Filter Versions by states. If not specified, return Versions in any state
          schema:
            $ref: "#/components/schemas/PurposeVersionState"
        - in: query
          name: offset
          description: Pagination starting position
          required: true
          schema:
            type: integer
            format: int32
            minimum: 0
        - in: query
          name: limit
          description: Maximum number of results to return
          required: true
          schema:
            type: integer
            format: int32
            minimum: 1
            maximum: 50
      responses:
        "200":
          description: Purpose Versions retrieved
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PurposeVersions"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "403":
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
    post:
      tags:
        - purposes
      summary: Create a new Purpose Version
      description: |
        Create a new Purpose Version to update daily calls
        The new Version will be created in Active state if daily calls are under the E-Service threshold, in Waiting for Approval otherwise
      operationId: createPurposeVersion
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PurposeVersionSeed"
        required: true
      responses:
        "201":
          description: Purpose Version created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PurposeVersion"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "403":
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "409":
          description: Conflict
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /purposes/{purposeId}/versions/{versionId}:
    parameters:
      - name: purposeId
        in: path
        description: The Purpose ID of the Version
        required: true
        schema:
          type: string
          format: uuid
      - name: versionId
        in: path
        description: The ID of the Version to retrieve
        required: true
        schema:
          type: string
          format: uuid
    get:
      tags:
        - purposes
      summary: Retrieve a Purpose Version
      description: Retrieve a Purpose Version
      operationId: getPurposeVersion
      responses:
        "200":
          description: Purpose Version retrieved
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PurposeVersion"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "403":
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /purposes/{purposeId}/activate:
    parameters:
      - name: purposeId
        description: The ID of the Purpose to approve
        in: path
        required: true
        schema:
          type: string
          format: uuid
    post:
      tags:
        - purposes
      summary: Activate a Purpose in Draft state
      description: | 
        Activate a Purpose that is in Draft states
        The new state will be Active if daily calls are under the E-Service threshold, Waiting for Approval otherwise
      operationId: activateDraftPurpose
      responses:
        "200":
          description: Purpose activated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Purpose"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "403":
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "409":
          description: Conflict
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /purposes/{purposeId}/archive:
    parameters:
      - name: purposeId
        description: The ID of the Purpose to archive
        in: path
        required: true
        schema:
          type: string
          format: uuid
    post:
      tags:
        - purposes
      summary: Archive a Purpose in Active or Suspended state
      description: |
        Archive a Purpose that is in Active or Suspended state, transitioning it to Archived state
        Existing Waiting for Approval Versions will be deleted
        The Archived state is not reversible
      operationId: archivePurpose
      responses:
        "200":
          description: Purpose archived
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Purpose"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "403":
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "409":
          description: Conflict
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /purposes/{purposeId}/approve:
    parameters:
      - name: purposeId
        description: The ID of the Purpose to approve
        in: path
        required: true
        schema:
          type: string
          format: uuid
    post:
      tags:
        - purposes
      summary: Approve a Purpose in Waiting for Approval state
      description: Approve a Purpose that is in Waiting for Approval state, transitioning it to Active state
      operationId: approvePurpose
      responses:
        "200":
          description: Purpose approved
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Purpose"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "403":
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "409":
          description: Conflict
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /purposes/{purposeId}/suspend:
    parameters:
      - name: purposeId
        description: The ID of the Purpose to suspend
        in: path
        required: true
        schema:
          type: string
          format: uuid
    post:
      tags:
        - purposes
      summary: Suspend a Purpose in Active or Suspended state
      description: |
        Suspend a Purpose that is in Active or Suspended state, transitioning it to Suspended state
        A Purpose may already be in Suspended state when previously suspended by the consumer or the producer
      operationId: suspendPurpose
      responses:
        "200":
          description: Purpose suspended
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Purpose"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "403":
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "409":
          description: Conflict
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /purposes/{purposeId}/unsuspend:
    parameters:
      - name: purposeId
        description: The ID of the Purpose to unsuspend
        in: path
        required: true
        schema:
          type: string
          format: uuid
    post:
      tags:
        - purposes
      summary: Unsuspend a Purpose in Suspended state
      description: |
        Unsuspend a Purpose that is in Suspended state, transitioning it to Active or Suspended state
        A Purpose may remain in Suspended state when suspended also by the consumer or the producer
      operationId: unsuspendPurpose
      responses:
        "200":
          description: Purpose unsuspended
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Purpose"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "403":
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "409":
          description: Conflict
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /tenants:
    get:
      tags:
        - tenants
      summary: List Tenants
      description: Retrieve a list of Tenants based on filters
      operationId: getTenants
      parameters:
        - in: query
          name: IPACode
          schema:
            type: string
          description: |
            IPA code of the Tenant
            If the Tenant is an AOO, it corresponds to "codice AOO" in IPA
            If the Tenant is an UO, it corresponds to "codice UO" in IPA
            Available only for Tenants listed in IPA
            Mutually exclusive with taxCode
        - in: query
          name: taxCode
          schema:
            type: string
          description: |
            Tax code of the Tenant
            Available only for Tenants not listed in IPA
            Mutually exclusive with IPACode
        - in: query
          name: offset
          description: Pagination starting position
          required: true
          schema:
            type: integer
            format: int32
            minimum: 0
        - in: query
          name: limit
          description: Maximum number of results to return
          required: true
          schema:
            type: integer
            format: int32
            minimum: 1
            maximum: 50
      responses:
        "200":
          description: Tenants retrieved
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Tenants"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /tenants/{tenantId}:
    parameters:
      - name: tenantId
        in: path
        description: The ID of the Tenant to retrieve
        required: true
        schema:
          type: string
          format: uuid
    get:
      tags:
        - tenants
      summary: Retrieve a Tenant
      description: Retrieve a Tenant
      operationId: getTenant
      responses:
        "200":
          description: Tenant retrieved
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Tenant"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /tenants/{tenantId}/certifiedAttributes:
    parameters:
      - name: tenantId
        in: path
        description: The Tenant ID of the Attributes
        required: true
        schema:
          type: string
          format: uuid
    get:
      tags:
        - tenants
      summary: List Tenant Certified Attributes
      description: Retrieve a list of Certified Attributes assigned to the Tenant
      operationId: getCertifiedAttributes
      parameters:
        - in: query
          name: offset
          description: Pagination starting position
          required: true
          schema:
            type: integer
            format: int32
            minimum: 0
        - in: query
          name: limit
          description: Maximum number of results to return
          required: true
          schema:
            type: integer
            format: int32
            minimum: 1
            maximum: 50
      responses:
        "200":
          description: Tenant Certified Attributes retrieved
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TenantCertifiedAttributes"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
    post:
      tags:
        - tenants
      summary: Assign a Certified Attribute to a Tenant
      description: Assign a Certified Attribute to a Tenant
      operationId: addCertifiedAttribute
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TenantCertifiedAttributeSeed"
        required: true
      responses:
        "200":
          description: Certified Attribute assigned
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TenantCertifiedAttribute"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "403":
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "409":
          description: Conflict
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /tenants/{tenantId}/certifiedAttributes/{attributeId}:
    parameters:
      - name: tenantId
        in: path
        description: The Tenant ID of the Attributes
        required: true
        schema:
          type: string
          format: uuid
      - name: attributeId
        in: path
        description: The Attribute ID
        required: true
        schema:
          type: string
          format: uuid
    delete:
      tags:
        - tenants
      summary: Revoke a Certified Attribute from a Tenant
      description: Revoke a Certified Attribute from a Tenant
      operationId: revokeCertifiedAttributeById
      responses:
        "200":
          description: Certified Attribute revoked
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TenantCertifiedAttribute"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "400":
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "401":
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "403":
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "404":
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
        "429":
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
  /status:
    get:
      tags:
        - health
      operationId: getStatus
      description: Retrieve the status of the API
      responses:
        "200":
          description: Status retrieved
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
          headers:
            X-Rate-Limit-Limit:
              $ref: "#/components/headers/RateLimitLimitHeader"
            X-Rate-Limit-Remaining:
              $ref: "#/components/headers/RateLimitRemainingHeader"
            X-Rate-Limit-Interval:
              $ref: "#/components/headers/RateLimitIntervalHeader"
components:
  schemas:
    Agreement:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          format: uuid
        eserviceId:
          type: string
          format: uuid
        descriptorId:
          type: string
          format: uuid
        producerId:
          type: string
          format: uuid
        consumerId:
          type: string
          format: uuid
        state:
          $ref: "#/components/schemas/AgreementState"
        suspendedByConsumer:
          type: boolean
        suspendedByProducer:
          type: boolean
        suspendedByPlatform:
          type: boolean
        consumerNotes:
          type: string
        rejectionReason:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        suspendedAt:
          type: string
          format: date-time
      required:
        - id
        - eserviceId
        - descriptorId
        - producerId
        - consumerId
        - state
        - createdAt
    AgreementApprovalPolicy:
      type: string
      description: E-Service Descriptor policy for new Agreements approval
      enum:
        - AUTOMATIC
        - MANUAL
    Agreements:
      type: object
      additionalProperties: false
      properties:
        results:
          type: array
          items:
            $ref: "#/components/schemas/Agreement"
        pagination:
          $ref: "#/components/schemas/Pagination"
      required:
        - results
        - pagination
    AgreementSeed:
      type: object
      additionalProperties: false
      description: Contains the information for agreement creation
      properties:
        eserviceId:
          type: string
          format: uuid
        descriptorId:
          type: string
          format: uuid
        delegationId:
          type: string
          format: uuid
      required:
        - eserviceId
        - descriptorId
    AgreementState:
      type: string
      description: Agreement State
      enum:
        - DRAFT
        - ACTIVE
        - ARCHIVED
        - PENDING
        - SUSPENDED
        - MISSING_CERTIFIED_ATTRIBUTES
        - REJECTED
    AgreementRejection:
      type: object
      additionalProperties: false
      description: contains the information for agreement rejection
      properties:
        reason:
          type: string
          minLength: 20
          maxLength: 1000
      required:
        - reason
    AgreementSubmission:
      type: object
      additionalProperties: false
      description: contains the information for agreement submission
      properties:
        consumerNotes:
          type: string
          maxLength: 1000
    CertifiedAttribute:
      title: Attribute
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          format: uuid
        code:
          type: string
          description: The identifier of the attribute on the source registry
        description:
          type: string
        origin:
          type: string
          description: Identifier of the origin of this attribute, e.g. "IPA"
        name:
          type: string
        createdAt:
          type: string
          format: date-time
      required:
        - id
        - name
        - description
        - code
        - origin
        - createdAt
    CertifiedAttributeSeed:
      title: AttributeSeed
      type: object
      additionalProperties: false
      description: Models the attribute registry entry as payload response
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 500
        description:
          type: string
          minLength: 1
          maxLength: 500
        code:
          type: string
          minLength: 1
          maxLength: 64
          description: The identifier of the attribute on the source registry
      required:
        - description
        - name
        - code
    ClientAddPurpose:
      type: object
      additionalProperties: false
      properties:
        purposeId:
          type: string
          format: uuid
      required:
        - purposeId
    ConsumerDelegation:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          format: uuid
        delegatorId:
          type: string
          format: uuid
        delegateId:
          type: string
          format: uuid
        eserviceId:
          type: string
          format: uuid
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        rejectionReason:
          type: string
        revokedAt:
          type: string
          format: date-time
        submittedAt:
          type: string
          format: date-time
        activatedAt:
          type: string
          format: date-time
        rejectedAt:
          type: string
          format: date-time
        state:
          $ref: "#/components/schemas/DelegationState"
      required:
        - id
        - delegatorId
        - delegateId
        - eserviceId
        - createdAt
        - state
        - kind
        - submittedAt
    ConsumerDelegations:
      type: object
      additionalProperties: false
      properties:
        results:
          type: array
          items:
            $ref: "#/components/schemas/ConsumerDelegation"
        pagination:
          $ref: "#/components/schemas/Pagination"
      required:
        - results
        - pagination
    DelegationState:
      type: string
      enum:
        - WAITING_FOR_APPROVAL
        - ACTIVE
        - REJECTED
        - REVOKED
    DelegationRejection:
      type: object
      additionalProperties: false
      properties:
        rejectionReason:
          type: string
      required:
        - rejectionReason
    DelegationSeed:
      type: object
      additionalProperties: false
      properties:
        eserviceId:
          type: string
          format: uuid
        delegateId:
          type: string
          format: uuid
      required:
        - eserviceId
        - delegateId
    EService:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          format: uuid
        producerId:
          type: string
          format: uuid
        name:
          type: string
        description:
          type: string
        technology:
          $ref: "#/components/schemas/EServiceTechnology"
        mode:
          $ref: "#/components/schemas/EServiceMode"
        isSignalHubEnabled:
          type: boolean
        isConsumerDelegable:
          type: boolean
        isClientAccessDelegable:
          type: boolean
        templateId:
          type: string
          format: uuid
      required:
        - id
        - producerId
        - name
        - description
        - technology
        - descriptors
        - riskAnalysis
        - mode
    EServiceDescriptor:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          format: uuid
        version:
          type: string
        description:
          type: string
        audience:
          type: array
          items:
            type: string
        voucherLifespan:
          type: integer
          format: int32
        dailyCallsPerConsumer:
          description: "maximum number of daily calls that this descriptor can afford per consumer."
          type: integer
          format: int32
          minimum: 1
        dailyCallsTotal:
          description: "total daily calls available for this e-service."
          type: integer
          format: int32
          minimum: 1
        state:
          $ref: "#/components/schemas/EServiceDescriptorState"
        agreementApprovalPolicy:
          $ref: "#/components/schemas/AgreementApprovalPolicy"
        serverUrls:
          type: array
          items:
            type: string
        publishedAt:
          type: string
          format: date-time
        suspendedAt:
          type: string
          format: date-time
        deprecatedAt:
          type: string
          format: date-time
        archivedAt:
          type: string
          format: date-time
        templateVersionId:
          type: string
          format: uuid
      required:
        - id
        - version
        - docs
        - state
        - creationDate
        - audience
        - voucherLifespan
        - dailyCallsPerConsumer
        - dailyCallsTotal
        - agreementApprovalPolicy
        - serverUrls
    EServiceDescriptors:
      type: object
      additionalProperties: false
      properties:
        results:
          type: array
          items:
            $ref: "#/components/schemas/EServiceDescriptor"
        pagination:
          $ref: "#/components/schemas/Pagination"
      required:
        - results
        - pagination
    EServiceDescriptorState:
      type: string
      description: E-Service Descriptor State
      enum:
        - DRAFT
        - PUBLISHED
        - DEPRECATED
        - SUSPENDED
        - ARCHIVED
        - WAITING_FOR_APPROVAL
    EServiceMode:
      type: string
      description: Indicates if the E-Service is intended for receiving or delivering data
      enum:
        - RECEIVE
        - DELIVER
    EServices:
      type: object
      additionalProperties: false
      properties:
        results:
          type: array
          items:
            $ref: "#/components/schemas/EService"
        pagination:
          $ref: "#/components/schemas/Pagination"
      required:
        - results
        - pagination
    EServiceTechnology:
      type: string
      description: API Technology
      enum:
        - REST
        - SOAP
    EServiceTemplate:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          format: uuid
        creatorId:
          type: string
          format: uuid
        name:
          type: string
        intendedTarget:
          type: string
        description:
          type: string
        technology:
          $ref: "#/components/schemas/EServiceTechnology"
        mode:
          $ref: "#/components/schemas/EServiceMode"
        isSignalHubEnabled:
          type: boolean
      required:
        - id
        - creatorId
        - name
        - intendedTarget
        - description
        - technology
        - riskAnalysis
        - mode
    EServiceTemplateVersion:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          format: uuid
        version:
          type: integer
          format: int32
        description:
          type: string
        voucherLifespan:
          type: integer
          format: int32
        dailyCallsPerConsumer:
          description: "maximum number of daily calls that this descriptor can afford per consumer."
          type: integer
          format: int32
          minimum: 1
        dailyCallsTotal:
          description: "total daily calls available for this e-service."
          type: integer
          format: int32
          minimum: 1
        state:
          $ref: "#/components/schemas/EServiceTemplateVersionState"
        agreementApprovalPolicy:
          $ref: "#/components/schemas/AgreementApprovalPolicy"
        publishedAt:
          type: string
          format: date-time
        suspendedAt:
          type: string
          format: date-time
        deprecatedAt:
          type: string
          format: date-time
      required:
        - id
        - version
        - state
        - creationDate
        - voucherLifespan
    EServiceTemplateVersionState:
      type: string
      description: E-Service Template Version State
      enum:
        - DRAFT
        - PUBLISHED
        - DEPRECATED
        - SUSPENDED
    EServiceTemplateVersions:
      type: object
      additionalProperties: false
      properties:
        results:
          type: array
          items:
            $ref: "#/components/schemas/EServiceTemplateVersion"
        pagination:
          $ref: "#/components/schemas/Pagination"
      required:
        - results
        - pagination
    JWK:
      description: JSON Web Key
      type: object
      additionalProperties: false
      properties:
        kty:
          type: string
        key_ops:
          type: array
          items:
            type: string
        use:
          type: string
        alg:
          type: string
        kid:
          type: string
        x5u:
          type: string
          minLength: 1
        x5t:
          type: string
        "x5t#S256":
          type: string
        x5c:
          type: array
          items:
            type: string
        crv:
          type: string
        x:
          type: string
        "y":
          type: string
        d:
          type: string
        k:
          type: string
        "n":
          type: string
        e:
          type: string
        p:
          type: string
        q:
          type: string
        dp:
          type: string
        dq:
          type: string
        qi:
          type: string
        oth:
          uniqueItems: false
          minItems: 1
          type: array
          items:
            $ref: "#/components/schemas/OtherPrimeInfo"
      required:
        - kty
        - kid
    OtherPrimeInfo:
      title: OtherPrimeInfo
      type: object
      additionalProperties: false
      properties:
        r:
          type: string
        d:
          type: string
        t:
          type: string
      required:
        - r
        - d
        - t
    Key:
      description: Key
      type: object
      additionalProperties: false
      properties:
        clientId:
          type: string
          format: uuid
        jwk:
          $ref: "#/components/schemas/JWK"
      required:
        - clientId
        - jwk
    ProducerKey:
      description: Key
      type: object
      additionalProperties: false
      properties:
        producerKeychainId:
          type: string
          format: uuid
        jwk:
          $ref: "#/components/schemas/JWK"
      required:
        - producerKeychainId
        - jwk
    Pagination:
      type: object
      additionalProperties: false
      properties:
        offset:
          type: integer
          format: int32
          minimum: 0
        limit:
          type: integer
          format: int32
          minimum: 1
          maximum: 50
        totalCount:
          type: integer
          format: int32
          minimum: 0
      required:
        - offset
        - limit
        - totalCount
    ExternalId:
      properties:
        origin:
          type: string
          minLength: 3
          maxLength: 64
        value:
          type: string
      required:
        - origin
        - value
    Purpose:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          format: uuid
        eserviceId:
          type: string
          format: uuid
        consumerId:
          type: string
          format: uuid
        suspendedByConsumer:
          type: boolean
        suspendedByProducer:
          type: boolean
        title:
          type: string
        description:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        isRiskAnalysisValid:
          type: boolean
        isFreeOfCharge:
          type: boolean
        freeOfChargeReason:
          type: string
        delegationId:
          type: string
          format: uuid
        currentVersion:
          $ref: "#/components/schemas/PurposeVersion"
        waitingForApprovalVersion:
          $ref: "#/components/schemas/PurposeVersion"
        rejectedVersion:
          $ref: "#/components/schemas/PurposeVersion"
      required:
        - id
        - eserviceId
        - consumerId
        - title
        - description
        - createdAt
        - isRiskAnalysisValid
        - isFreeOfCharge
    PurposeSeed:
      type: object
      additionalProperties: false
      description: contains the expected payload for purpose creation
      properties:
        eserviceId:
          type: string
          format: uuid
        delegationId:
          type: string
          format: uuid
        riskAnalysisForm:
          $ref: "#/components/schemas/RiskAnalysisFormSeed"
        title:
          type: string
          minLength: 5
          maxLength: 60
        description:
          type: string
          minLength: 10
          maxLength: 250
        isFreeOfCharge:
          type: boolean
        freeOfChargeReason:
          type: string
        dailyCalls:
          type: integer
          format: int32
          minimum: 0
      required:
        - eserviceId
        - title
        - description
        - isFreeOfCharge
        - dailyCalls
    Purposes:
      type: object
      additionalProperties: false
      properties:
        results:
          type: array
          items:
            $ref: "#/components/schemas/Purpose"
        pagination:
          $ref: "#/components/schemas/Pagination"
      required:
        - results
        - pagination
    PurposeVersion:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          format: uuid
        state:
          $ref: "#/components/schemas/PurposeVersionState"
        createdAt:
          type: string
          format: date-time
        suspendedAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        firstActivationAt:
          type: string
          format: date-time
        dailyCalls:
          description: Maximum number of daily calls performed using this version
          type: integer
          format: int32
          minimum: 0
        rejectionReason:
          type: string
      required:
        - id
        - state
        - dailyCalls
        - createdAt
      description: business representation of a purpose version
    PurposeVersions:
      type: object
      additionalProperties: false
      properties:
        results:
          type: array
          items:
            $ref: "#/components/schemas/PurposeVersion"
        pagination:
          $ref: "#/components/schemas/Pagination"
      required:
        - results
        - pagination
    PurposeVersionSeed:
      type: object
      additionalProperties: false
      required:
        - dailyCalls
      properties:
        dailyCalls:
          description: Maximum number of daily calls performed using this version
          type: integer
          format: int32
          minimum: 0
    PurposeVersionState:
      type: string
      description: Purpose State
      enum:
        - ACTIVE
        - DRAFT
        - SUSPENDED
        - WAITING_FOR_APPROVAL
        - ARCHIVED
        - REJECTED
    RiskAnalysisFormSeed:
      type: object
      additionalProperties: false
      properties:
        version:
          type: string
          minLength: 1
          maxLength: 250
        answers:
          additionalProperties:
            type: array
            items:
              type: string
              minLength: 1
              maxLength: 250
      required:
        - version
        - answers
    Tenant:
      description: Tenant model
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          format: uuid
        externalId:
          $ref: "#/components/schemas/ExternalId"
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        name:
          type: string
        kind:
          $ref: "#/components/schemas/TenantKind"
        onboardedAt:
          type: string
          format: date-time
        subUnitType:
          $ref: "#/components/schemas/TenantSubUnitType"
      required:
        - id
        - certifier
        - externalId
        - attributes
        - createdAt
        - mails
        - name
    TenantKind:
      type: string
      enum:
        - PA
        - PRIVATE
        - GSP
        - SCP
    Tenants:
      type: object
      additionalProperties: false
      properties:
        results:
          type: array
          items:
            $ref: "#/components/schemas/Tenant"
        pagination:
          $ref: "#/components/schemas/Pagination"
      required:
        - results
        - pagination
    TenantSubUnitType:
      type: string
      enum:
        - AOO
        - UO
    TenantCertifiedAttribute:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          format: uuid
        assignedAt:
          type: string
          format: date-time
        revokedAt:
          type: string
          format: date-time
      required:
        - id
        - assignedAt
    TenantCertifiedAttributes:
      type: object
      additionalProperties: false
      properties:
        results:
          type: array
          items:
            $ref: "#/components/schemas/TenantCertifiedAttribute"
        pagination:
          $ref: "#/components/schemas/Pagination"
      required:
        - results
        - pagination
    TenantCertifiedAttributeSeed:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          format: uuid
      required:
        - id
    Problem:
      properties:
        type:
          description: URI reference of type definition
          type: string
        status:
          description: The HTTP status code generated by the origin server for this occurrence of the problem
          example: 503
          exclusiveMaximum: true
          format: int32
          maximum: 600
          minimum: 100
          type: integer
        title:
          description: A short, summary of the problem type. Written in english and readable
          example: Service Unavailable
          maxLength: 64
          pattern: "^[ -~]{0,64}$"
          type: string
        correlationId:
          description: Unique identifier of the request
          example: "53af4f2d-0c87-41ef-a645-b726a821852b"
          maxLength: 64
          type: string
        detail:
          description: A human readable explanation of the problem
          example: Request took too long to complete
          maxLength: 4096
          pattern: "^.{0,1024}$"
          type: string
        errors:
          type: array
          minItems: 1
          items:
            $ref: "#/components/schemas/ProblemError"
      additionalProperties: false
      required:
        - type
        - status
        - title
        - errors
    ProblemError:
      properties:
        code:
          description: Internal code of the error
          example: 123-4567
          minLength: 8
          maxLength: 8
          pattern: "^[0-9]{3}-[0-9]{4}$"
          type: string
        detail:
          description: A human readable explanation specific to this occurrence of the problem
          example: Parameter not valid
          maxLength: 4096
          pattern: "^.{0,1024}$"
          type: string
      required:
        - code
        - detail
  headers:
    RateLimitLimitHeader:
      schema:
        type: integer
        format: int32
        minimum: 0
      description: Max allowed requests within time interval
    RateLimitRemainingHeader:
      schema:
        type: integer
        format: int32
        minimum: 0
      description: Remaining requests within time interval
    RateLimitIntervalHeader:
      schema:
        type: integer
        format: int32
        minimum: 0
      description: Time interval in milliseconds. Allowed requests will be constantly replenished during the interval. At the end of the interval the max allowed requests will be available
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
