openapi: 3.0.1
info:
  title: PadpReferenceApi
  version: '1.0'
paths:
  /poc/encrypt-decrypt-poc:
    get:
      tags:
        - Encrypt/decrypt POC
      summary: Encrypt/Decrypt POC
      operationId: EncryptDecryptPoc
      parameters:
        - name: textToEncrypt
          in: header
          required: true
          schema:
            type: string
        - name: encryptedEphemeralKey
          in: query
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            text/plain:
              schema:
                type: string
  /poc/encrypt-poc:
    get:
      tags:
        - Encrypt/decrypt POC
      summary: Encrypt POC
      operationId: EncryptPoc
      parameters:
        - name: textToEncrypt
          in: header
          required: true
          schema:
            type: string
        - name: encryptedEphemeralKey
          in: query
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            text/plain:
              schema:
                type: string
  /poc/decrypt-poc:
    get:
      tags:
        - Encrypt/decrypt POC
      summary: Decrypt POC
      operationId: DecryptPoc
      parameters:
        - name: textToDecrypt
          in: header
          required: true
          schema:
            type: string
        - name: encryptedEphemeralKey
          in: query
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            text/plain:
              schema:
                type: string
  /idp/b2b-access-token:
    get:
      tags:
        - PADP Reference API
      summary: API 1020 - Get B2B Access Token
      description: Returns a client access token, needed for most other PADP APIs.
      operationId: GetB2bAccessToken
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/B2bAccessToken'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /get-image-from-base64:
    get:
      tags:
        - PADP Reference API
      summary: Get rendered image from Base64 encoded String
      operationId: GetImageFromBase64
      parameters:
        - name: base64String
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            image/jpeg:
              schema:
                $ref: '#/components/schemas/FileContentHttpResult'
  /personal-data/{xtat}:
    post:
      tags:
        - PADP Reference API
      summary: API 1201 - Create Personal Data - First create an ephemeral key using API 1210!
      description: First create an ephemeral key using API 1210!
      operationId: CreatePersonalData
      parameters:
        - name: xtat
          in: path
          required: true
          schema:
            type: string
        - name: email
          in: query
          description: Email address to be used for OTP challenges
          required: true
          schema:
            type: string
        - name: name
          in: query
          description: Should be at least two words (first name and last name)
          schema:
            type: string
        - name: birthDate
          in: query
          description: Should be a date between 1900-01-01 and now, in the format YYYY-MM-DD
          schema:
            type: string
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                photo:
                  type: string
                  description: Should be a JPG image, of max. 512KB and resolution between 520x520 and 720x720
                  format: binary
            encoding:
              photo:
                style: form
      responses:
        '201':
          description: Created
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
    get:
      tags:
        - PADP Reference API
      summary: API 1202 - Get Personal Data- First perform an OTP challenge using API 1206 and 1207!
      description: First perform an OTP challenge using API 1206 and 1207!
      operationId: GetPersonalData
      parameters:
        - name: xtat
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PersonalData'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
    delete:
      tags:
        - PADP Reference API
      summary: API 1204 - Delete Personal Data - First perform an OTP challenge using API 1206 and 1207!
      description: First perform an OTP challenge using API 1206 and 1207!
      operationId: DeletePersonalData
      parameters:
        - name: xtat
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeletePersonalDataResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
    put:
      tags:
        - PADP Reference API
      summary: API 1205 - Update Personal Data - First perform an OTP challenge using API 1206 and 1207!
      description: First perform an OTP challenge using API 1206 and 1207!Performs a complete replacement; empty request parameters will result in the corresponding PADP attribute being deleted.
      operationId: UpdatePersonalData
      parameters:
        - name: xtat
          in: path
          required: true
          schema:
            type: string
        - name: skipUpdateCounter
          in: query
          required: true
          schema:
            type: boolean
        - name: name
          in: query
          description: Should be at least two words (first name and last name)
          schema:
            type: string
        - name: birthDate
          in: query
          description: Should be a date between 1900-01-01 and now, in the format YYYY-MM-DD
          schema:
            type: string
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                photo:
                  type: string
                  description: Should be a JPG image, of max. 512KB and resolution between 520x520 and 720x720
                  format: binary
            encoding:
              photo:
                style: form
      responses:
        '200':
          description: OK
  /personal-data/{xtat}/decrypted:
    get:
      tags:
        - PADP Reference API
      summary: API 1202 - Get Personal Data AND decrypt response - First perform an OTP challenge using API 1206 and 1207!
      description: First perform an OTP challenge using API 1206 and 1207!
      operationId: GetDecryptedPersonalData
      parameters:
        - name: xtat
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DecryptedPersonalData'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /personal-data/{xtat}/generate-otp:
    get:
      tags:
        - PADP Reference API
      summary: API 1206 - Generate OTP
      operationId: GenerateOtp
      parameters:
        - name: xtat
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OtpResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /personal-data/{xtat}/validate-otp:
    get:
      tags:
        - PADP Reference API
      summary: API 1207 - Validate OTP
      operationId: ValidateOtp
      parameters:
        - name: xtat
          in: path
          required: true
          schema:
            type: string
        - name: otp
          in: query
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserAccessToken'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /personal-data/{xtat}/encrypted-update-init:
    get:
      tags:
        - PADP Reference API
      summary: API 1210 - Create Ephemeral Key
      operationId: CreateEphemeralKey
      parameters:
        - name: xtat
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EphemeralKey'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /personal-data/{xtat}/administrative-data:
    get:
      tags:
        - PADP Reference API
      summary: API 1211 - Get Administrative Data
      operationId: GetAdministrativeData
      parameters:
        - name: xtat
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdministrativeData'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    AdministrativeData:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/AdministrativeDataElement'
        photo:
          $ref: '#/components/schemas/AdministrativeDataElement'
        birthdate:
          $ref: '#/components/schemas/AdministrativeDataElement'
      additionalProperties: false
    AdministrativeDataElement:
      type: object
      properties:
        inaccuracyFlag:
          type: boolean
        inaccuracyFlagReason:
          type: string
          nullable: true
        inaccuracyFlagCounter:
          type: integer
          format: int32
        changeCounter:
          type: integer
          format: int32
        maxUpdatesVerificationCount:
          type: integer
          format: int32
        lastChangeDate:
          type: string
          format: date-time
        isValidated:
          type: boolean
      additionalProperties: false
    B2bAccessToken:
      type: object
      properties:
        access_token:
          type: string
          nullable: true
        expires_in:
          type: integer
          format: int32
        refresh_expires_in:
          type: integer
          format: int32
        refresh_token:
          type: string
          nullable: true
        token_type:
          type: string
          nullable: true
        not-before-policy:
          type: integer
          format: int32
        scope:
          type: string
          nullable: true
        BE_ID:
          type: string
          nullable: true
      additionalProperties: false
    ByteReadOnlyMemory:
      type: object
      properties:
        length:
          type: integer
          format: int32
          readOnly: true
        isEmpty:
          type: boolean
          readOnly: true
        span:
          $ref: '#/components/schemas/ByteReadOnlySpan'
      additionalProperties: false
    ByteReadOnlySpan:
      type: object
      properties:
        length:
          type: integer
          format: int32
          readOnly: true
        isEmpty:
          type: boolean
          readOnly: true
      additionalProperties: false
    Data:
      type: object
      properties:
        name:
          type: string
          nullable: true
        birthdate:
          type: string
          nullable: true
        photo:
          type: string
          nullable: true
      additionalProperties: false
    DecryptedData:
      type: object
      properties:
        decryptedName:
          type: string
          nullable: true
        decryptedBirthdate:
          type: string
          nullable: true
        decryptedPhoto:
          type: string
          description: Base64 encoded photo
          format: byte
          nullable: true
      additionalProperties: false
    DecryptedPersonalData:
      type: object
      properties:
        decryptedData:
          $ref: '#/components/schemas/DecryptedData'
        encryptedData:
          $ref: '#/components/schemas/PersonalData'
      additionalProperties: false
    DeletePersonalDataResponse:
      type: object
      properties:
        deletedAttributes:
          type: array
          items:
            type: string
          nullable: true
      additionalProperties: false
    EntityTagHeaderValue:
      type: object
      properties:
        tag:
          $ref: '#/components/schemas/StringSegment'
        isWeak:
          type: boolean
          readOnly: true
      additionalProperties: false
    EphemeralKey:
      type: object
      properties:
        ephemeralKeyAlias:
          type: string
          nullable: true
        encryptedEphemeralKey:
          type: string
          nullable: true
      additionalProperties: false
    Error:
      type: object
      properties:
        code:
          type: string
          nullable: true
        data:
          type: array
          items:
            type: string
          nullable: true
        message:
          type: string
          nullable: true
      additionalProperties: false
    ErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/Error'
          nullable: true
        exceptionClassName:
          type: string
          nullable: true
        exceptionStackTrace:
          type: string
          nullable: true
      additionalProperties: false
    FileContentHttpResult:
      type: object
      properties:
        contentType:
          type: string
          nullable: true
          readOnly: true
        fileDownloadName:
          type: string
          nullable: true
          readOnly: true
        lastModified:
          type: string
          format: date-time
          nullable: true
          readOnly: true
        entityTag:
          $ref: '#/components/schemas/EntityTagHeaderValue'
        enableRangeProcessing:
          type: boolean
          readOnly: true
        fileLength:
          type: integer
          format: int64
          nullable: true
          readOnly: true
        fileContents:
          $ref: '#/components/schemas/ByteReadOnlyMemory'
      additionalProperties: false
    Metadata:
      type: object
      properties:
        encryptedEphemeralKey:
          type: string
          nullable: true
      additionalProperties: false
    OtpResponse:
      type: object
      properties:
        maskedEmailAddress:
          type: string
          nullable: true
      additionalProperties: false
    PersonalData:
      type: object
      properties:
        metadata:
          $ref: '#/components/schemas/Metadata'
        data:
          $ref: '#/components/schemas/Data'
      additionalProperties: false
    StringSegment:
      type: object
      properties:
        buffer:
          type: string
          nullable: true
        offset:
          type: integer
          format: int32
          readOnly: true
        length:
          type: integer
          format: int32
          readOnly: true
        value:
          type: string
          nullable: true
          readOnly: true
        hasValue:
          type: boolean
          readOnly: true
      additionalProperties: false
    UserAccessToken:
      type: object
      properties:
        accessToken:
          type: string
          nullable: true
      additionalProperties: false
