{
  "openapi": "3.0.0",
  "info": {
    "title": "Application Sender API",
    "version": "0.7",
    "description": "API vom Onlineantragsdienst zum Zustelldienst",
    "contact": {
      "name": "FITKO",
      "url": "https://www.fitko.de/"
    },
    "license": {
      "url": "https://creativecommons.org/licenses/by-sa/4.0/",
      "name": "Creative Commons Attribution Share Alike 4.0 (CC BY-SA 4.0)"
    }
  },
  "servers": [
    {
      "url": "https://sender-test.fiep-poc.de/beta7",
      "description": "Testsystem"
    }
  ],
  "paths": {
    "/destinations/{destinationId}": {
      "parameters": [
        {
          "schema": {
            "type": "string"
          },
          "name": "destinationId",
          "in": "path",
          "required": true
        }
      ],
      "get": {
        "summary": "Get Destination Info",
        "operationId": "get-destination-info",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/destination.json"
                },
                "examples": {
                  "example-1": {
                    "value": {
                      "publicOrganization": {
                        "organizationName": "Gewerbeamt Musterstadt",
                        "address": {
                          "type": "national",
                          "street": "Kurzer Weg",
                          "houseNumber": "7",
                          "postalCode": "12345",
                          "city": "Ankh-Morpork"
                        },
                        "contact": {
                          "telephones": [
                            {
                              "number": "+49 89 32168-0",
                              "mobile": false,
                              "description": "work"
                            }
                          ],
                          "email": "behoerde@example.com"
                        }
                      },
                      "technicalContact": [
                        {
                          "formOfAddress": "Herr",
                          "doctoralDegrees": "Dr.",
                          "firstName": "Kunibert",
                          "lastName": "Vonundzu",
                          "contact": {
                            "telephones": [
                              {
                                "number": "+49 89 32168-42",
                                "mobile": false,
                                "description": "work"
                              },
                              {
                                "number": "+49 123 456789",
                                "mobile": true,
                                "description": "work"
                              }
                            ],
                            "email": "kunibert.vonundzu@example.com"
                          }
                        }
                      ],
                      "schemas": [
                        {
                          "mimeType": "application/json",
                          "schemaSource": "none",
                        }
                      ],
                      "callback": {
                        "callbackURI": "http://127.0.0.1:4010/voluptas"
                      },
                      "destinationId": "7881dba9-4055-4854-8b6d-11ea5b7f3047"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          }
        },
        "description": "Ruft die Information über eine Destination ab",
        "tags": [
          "Transfer related Information"
        ],
        "security": [
          {
            "OAuth20": [
              "destination:send"
            ]
          }
        ]
      }
    },
    "/destinations/{destinationId}/applications/{applicationId}/docs/{docId}": {
      "parameters": [
        {
          "schema": {
            "type": "string"
          },
          "name": "destinationId",
          "in": "path",
          "required": true
        },
        {
          "schema": {
            "type": "string"
          },
          "name": "applicationId",
          "in": "path",
          "required": true
        },
        {
          "schema": {
            "type": "string"
          },
          "name": "docId",
          "in": "path",
          "required": true
        }
      ],
      "put": {
        "summary": "Add Application Document",
        "operationId": "add-application-doc",
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "result": {
                      "type": "string",
                      "enum": [
                        "success"
                      ]
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          }
        },
        "description": "Lädt ein Antragsformuar oder einen Anhang hoch, um ihn dem Antrag hinzuzufügen.",
        "requestBody": {
          "content": {
            "*/*": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          }
        },
        "tags": [
          "Application Transfer"
        ],
        "security": [
          {
            "OAuth20": [
              "destination:send"
            ]
          }
        ]
      }
    },
    "/destinations/{destinationId}/applications/{applicationId}/data": {
      "parameters": [
        {
          "schema": {
            "type": "string"
          },
          "name": "destinationId",
          "in": "path",
          "required": true
        },
        {
          "schema": {
            "type": "string"
          },
          "name": "applicationId",
          "in": "path",
          "required": true
        }
      ],
      "put": {
        "summary": "Add Application Data",
        "operationId": "add-application-data",
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "result": {
                      "type": "string",
                      "enum": [
                        "success"
                      ]
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          },
          "415": {
            "description": "Unsupported Media Type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          }
        },
        "description": "Datensatz übertragen",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {},
                "type": "object"
              },
              "examples": {
                "example-1": {
                  "value": {
                    "F99000001": "string",
                    "G99000001": {
                      "F99000002": "string",
                      "F99000003": 42
                    },
                    "G99000002": [
                      {
                        "F99000004": true,
                        "G99000001": {
                          "F99000002": "string",
                          "F99000003": 17
                        }
                      },
                      {
                        "F99000004": true,
                        "G99000001": {
                          "F99000002": "string",
                          "F99000003": 24
                        }
                      }
                    ]
                  }
                }
              }
            },
            "application/xml": {
              "schema": {
                "type": "object",
                "properties": {}
              }
            },
            "application/jose": {
              "schema": {
                "type": "string",
                "pattern": "^[a-zA-Z0-9-_=.]+$",
                "description": "JSON Web Encryption Compact Serialization, RFC 7516"
              },
              "examples": {
                "example-1": {
                  "value": "eyJlbmMiOiJBMjU2R0NNIiwiYWxnIjoiUlNBLU9BRVAtMjU2In0.nlXGAufYH36IABDy0En0LXEhGfC20IZSSchs27ADalHpRoTZKfXhc7hcMk8Y9V8yTP0jYbmrq6NtEg-QS2O5TQFD9Hluhpb631PBgKjPXHYX1Y6iUcR1sXxSUPjePi8F8PcZUZuUJLnhz6myyc9scdAq9BXG2cDJVgkfLI8eZdrqnrY24Hh32_7d5OKLFSpSDrBlqfyQuY8Wbs2h8Wy4Z4hwT1aWDO7b-SqJA181hUbNcF_rR4Mze3Fdtu-3uOIQYgLBBRmN1ZHDLk0EKNCI4B8MyDKLGPoM0ZomV5lVwVWjAMRI4CgQkIQ9rnm-Adof-GbegQL3yJSoNIWRWgzCnZBYZ638QgPllCMVW3WvEVvsgj0Hj16PbofqXTQ5S73LINfP6FZawfC0yMrYjSV_N2L0Lkp2KI3BkJcy-PcFhBnhwu2IsJGAlyDRCnXdVqig8m5yLHuSMQTpLW69LzPEskfsjhnNDR-CEBZpicjMfc-4CL6U7E7YoGc_99DzE5U5._JfqyKH23GiKsnDW.ZtMMjZ3GgcgHss8qbFRhrjl4L0kAfbco-oXICkk.VBHJ00FyDTYjOA_OYfiz5g"
                }
              }
            },
            "text/plain": {
              "schema": {
                "$ref": "../models/common/base64.json"
              }
            }
          },
          "description": "JSON oder XML Daten JWE-verschlüsselt"
        },
        "tags": [
          "Application Transfer"
        ],
        "security": [
          {
            "OAuth20": [
              "destination:send"
            ]
          }
        ]
      }
    },
    "/destinations/{destinationId}/applications/{applicationId}/status/history": {
      "parameters": [
        {
          "schema": {
            "type": "string"
          },
          "name": "applicationId",
          "in": "path",
          "required": true
        },
        {
          "schema": {
            "type": "string"
          },
          "name": "destinationId",
          "in": "path",
          "required": true
        }
      ],
      "get": {
        "summary": "Get Status History",
        "tags": [
          "status"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "current": {
                      "$ref": "../models/status-overview.json"
                    },
                    "history": {
                      "type": "array",
                      "maxItems": 3,
                      "minItems": 0,
                      "items": {
                        "$ref": "../models/status-overview.json"
                      }
                    }
                  }
                },
                "examples": {
                  "example-1": {
                    "value": {
                      "current": {
                        "code": "queued",
                        "timestamp": "2020-05-20T08:31:01+02:00",
                        "number": 2
                      },
                      "history": [
                        {
                          "code": "incomplete",
                          "timestamp": "2020-05-20T08:30:08+02:00",
                          "number": 1
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          }
        },
        "operationId": "get-application-status-history",
        "description": "Ruft den aktuellen Status der Übermittlung sowie einer Übersicht der bisherigen Übertragungshistorie ab.",
        "security": [
          {
            "OAuth20": [
              "destination:send"
            ]
          }
        ]
      }
    },
    "/destinations/{destinationId}/applications/{applicationId}/upload-status": {
      "parameters": [
        {
          "schema": {
            "type": "string"
          },
          "name": "destinationId",
          "in": "path",
          "required": true
        },
        {
          "schema": {
            "type": "string"
          },
          "name": "applicationId",
          "in": "path",
          "required": true
        }
      ],
      "get": {
        "summary": "Get Application Upload Status",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": [
                            "missing",
                            "partial",
                            "complete"
                          ]
                        },
                        "length": {
                          "type": "integer",
                          "minimum": 0
                        }
                      },
                      "required": [
                        "status",
                        "length"
                      ]
                    },
                    "docs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "docId": {
                            "type": "string",
                            "pattern": "^[-_.A-Za-z0-9]+$",
                            "description": "Id des Dokuments. Diese muss nur innerhalb des Antrags (Application) eindeutig sein. Es wird daher empfohlen, die IDs fortlaufend (1, 2 etc.) zu vergeben."
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "missing",
                              "partial",
                              "complete"
                            ]
                          },
                          "length": {
                            "type": "integer",
                            "minimum": 0
                          }
                        },
                        "required": [
                          "docId",
                          "status",
                          "length"
                        ]
                      }
                    }
                  }
                },
                "examples": {
                  "example-1": {
                    "value": {
                      "data": {
                        "status": "complete",
                        "length": 0
                      },
                      "docs": [
                        {
                          "status": "complete",
                          "docId": "1",
                          "length": 13046
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          }
        },
        "operationId": "get-application-upload-status",
        "description": "Abfrage des Übermittlungsstatus. Listet alle Unterresourcen (data und docs) mit Übermittlungsstatus auf.",
        "tags": [
          "Transfer related Information"
        ],
        "security": [
          {
            "OAuth20": [
              "destination:send"
            ]
          }
        ]
      }
    },
    "/destinations/{destinationId}/applications": {
      "parameters": [
        {
          "schema": {
            "type": "string"
          },
          "name": "destinationId",
          "in": "path",
          "required": true
        }
      ],
      "post": {
        "summary": "Create Application",
        "operationId": "create-application",
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "applicationId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "applicationId"
                  ]
                },
                "examples": {
                  "example-1": {
                    "value": {
                      "applicationId": "0c508e3f-2353-4206-9a1e-34b2e864d5a8"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          },
          "404": {
            "description": "Not Found"
          },
          "413": {
            "description": "Request Entity Too Large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "../models/application/metadata-no-id.json"
              },
              "examples": {
                "example-1": {
                  "value": {
                    "additionalReferenceInfo": {
                      "subject": "Anmeldung eines Gewerbes in Musterstadt",
                      "caseId": "DF/8923"
                    },
                    "contentStructure": {
                      "data": {
                        "schema": {
                          "mimeType": "application/json",
                          "schemaSource": "none",
                        }
                      },
                      "docs": [
                        {
                          "docId": "1",
                          "purpose": "form",
                          "size": 13046,
                          "mimeType": "application/pdf",
                          "filename": "test.pdf",
                          "description": "Das Antragsformular",
                          "lang": {
                            "lang": "de",
                            "region": "DE"
                          },
                          "hash": {
                            "algorithm": "SHA-256",
                            "digest": "bf37d894fdf9aeade63975ed648d49c3e8a7a773923597d2418915f54cd7c3b9"
                          }
                        }
                      ]
                    },
                    "publicServiceType": {
                      "name": "Gewerbeanmeldung",
                      "description": "Eine Gewerbeanmeldung ist immer dann notwendig, wenn Sie einen stehenden Gewerbebetrieb beginnen.",
                      "leikaId": "99050012104000",
                      "otherIdentifiers": [
                        {
                          "id": "8664844",
                          "schemeId": "service.niedersachsen.de",
                          "schemeName": "Serviceportal Niedersachsen"
                        },
                        {
                          "id": "354824",
                          "schemeId": "buerger.thueringen.de",
                          "schemeName": "Zuständigkeitsfinder Thüringen"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "description": "Metadaten des Antrags"
        },
        "description": "Übertragung initiieren",
        "tags": [
          "Application Transfer"
        ],
        "security": [
          {
            "OAuth20": [
              "destination:send"
            ]
          }
        ]
      }
    },
    "/destinations/{destinationId}/applications/{applicationId}/status": {
      "parameters": [
        {
          "schema": {
            "type": "string"
          },
          "name": "destinationId",
          "in": "path",
          "required": true
        },
        {
          "schema": {
            "type": "string"
          },
          "name": "applicationId",
          "in": "path",
          "required": true
        }
      ],
      "get": {
        "summary": "Get Status (current)",
        "tags": [
          "status"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/status-overview.json"
                },
                "examples": {
                  "example-1": {
                    "value": {
                      "code": "queued",
                      "timestamp": "2020-05-20T08:31:01+02:00",
                      "number": 2
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          }
        },
        "operationId": "get-application-status",
        "description": "Ruft den aktuellen Status der Übermittlung ab.",
        "security": [
          {
            "OAuth20": [
              "destination:send"
            ]
          }
        ]
      },
      "put": {
        "summary": "Send Application",
        "operationId": "commit-application",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/status-overview.json"
                },
                "examples": {
                  "example-1": {
                    "value": {
                      "code": "queued",
                      "timestamp": "2020-05-20T08:31:01.135842+02:00",
                      "number": 2
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "../models/error-body.json"
                }
              }
            }
          }
        },
        "description": "Übertragung abschließen, Antrag absenden",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "enum": [
                      "queued"
                    ]
                  }
                },
                "required": [
                  "code"
                ]
              },
              "examples": {
                "example-1": {
                  "value": {
                    "code": "queued"
                  }
                }
              }
            }
          },
          "description": ""
        },
        "tags": [
          "Application Transfer"
        ],
        "security": [
          {
            "OAuth20": [
              "destination:send"
            ]
          }
        ]
      }
    },
    "/info": {
      "get": {
        "summary": "Get Info",
        "tags": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "version": {
                      "type": "object",
                      "properties": {
                        "major": {
                          "type": "integer"
                        },
                        "minor": {
                          "type": "integer"
                        },
                        "patch": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "example-1": {
                    "value": {
                      "version": {
                        "major": 0,
                        "minor": 7,
                        "patch": 0
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "get-info",
        "security": [
          {
            "OAuth20": [
              "destination:send"
            ]
          }
        ],
        "description": "Gibt Informationen über den Server aus. Kann zu Testzwecken aufgerufen werden (Test der Erreichbarkeit und Zugriffaberechtigung)."
      }
    }
  },
  "tags": [
    {
      "name": "Application Transfer"
    },
    {
      "name": "status"
    },
    {
      "name": "Transfer related Information"
    }
  ],
  "components": {
    "securitySchemes": {
      "OAuth20": {
        "type": "oauth2",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://sender-test-token.fiep-poc.de/auth/realms/test/protocol/openid-connect/token",
            "scopes": {
              "destination:send": "Dieser Zufriffsbereich erlaubt es Anträge (Applications) an alle Zustellpunkte (Destinations) über die Application Sender API zu senden."
            }
          }
        },
        "description": "Dieses Authentifizierungsmethode wird genutzt, um den Zugriff auf die API zu autorisieren. "
      }
    }
  }
}