> For the complete documentation index, see [llms.txt](https://uniquid.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://uniquid.gitbook.io/documentation/appendix-1/untitled.md).

# Permission Management Service HTTP APIs  Part1

![](https://410297885-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fdocumentation%2F-LnNAWHXsKPolZgzSM-A%2F-LnNCMvmUF6klUAIutCE%2F0.png?generation=1566995489274911\&alt=media)

| <p><strong>System Architecture</strong></p><p>Appendix</p><p>Permission Management Service HTTP APIs</p> |
| :------------------------------------------------------------------------------------------------------: |
|                                                  Part 1                                                  |

| Document ID | uid-sys-arch |
| ----------- | ------------ |
| Version     | 1.0          |
| Status      | Release      |

## Appendix

### API Documentation

The appendix contains reference information about UniquID’s API.

### Permission Management Service HTTP APIs

#### API Overview

The described API operated with structures that always in JSON format.

All responses have Content-Type: application/json

| **METHOD** | **URI**                 | **DESCRIPTION**                        |
| ---------- | ----------------------- | -------------------------------------- |
| GET        | /api/v1/devices         | Get all managed devices                |
| GET        | /api/v1/devices/:xpub   | Get info about specific device         |
| GET        | /api/v1/contracts       | Get list of the access contracts       |
| POST       | /api/v1/contracts       | Create new access contracts            |
| DELETE     | /api/v1/contracts/:txid | Revoke existing access contracts       |
| GET        | /api/v1/info            | Returns information about orchestrator |
| GET        | /api/v1/properties      | Get orchestrator properties            |
| POST       | /api/v1/properties      | Upload data and saves the file on disk |
| POST       | /api/v1/init            | Init orchestrator                      |

#### Detailed API description

### Get all managed devices

Required the JSESSIONID in the request cookies, user must be logged in (see: Login API)

The API returns all managed devices. User must be logged on.&#x20;

* If success - API returns a JSON array of all the orchestrated devices in the response body. &#x20;
* If no device found – then returns http code 404 Not found, with error description in the body.&#x20;
* If the JSESSIONID is absent, incorrect or expired, then return http code 401 Unauthorized with the error description in the response body. &#x20;
* If an exception throws during the process – then return http code 500 Internal server error with the reason description of error.&#x20;

Request:

| **METHOD** | **REQUEST**     | **BODY/HEADERS**                    |
| ---------- | --------------- | ----------------------------------- |
| GET        | /api/v1/devices | Cookie: JSESSIONID=298zf09hf012fh2; |

Response:

| **HTTP CODE**             | **BODY**                                                                                                                                                                                                                                                                                                                                                                     | **MEANING**                                                                                                                                                                                                                                                                                                  |
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| 200 OK                    | <p>\[ <br>   { <br>      "name": "device\_name\_1", <br>      "xpub": "public\_key\_1", <br>      "recipe": "test", <br>      "contracts": 1, <br>      "shared": false <br>   }, { <br>      "name": "device\_name\_2", <br>      "xpub": "public\_key\_2", <br>      "recipe": "test", <br>      "contracts": 1, <br>      "shared": false <br>   }, <br>   ... <br>] </p> | <p>Success! </p><p>name – name of the device <br>xpub – public key of the device <br>recipe – is always "test" <br>contracts – number of contracts involving this device, are always 1 <br>shared – flag indicates if this is Shared Device; provided for future evolution. Always false in this version</p> |
| 404 Not Found             | <p>{ <br>   "error": "No devices found" <br>} </p>                                                                                                                                                                                                                                                                                                                           | <p>Error! Orchestrator have no devices </p><p>error – text message, describes the error reason </p>                                                                                                                                                                                                          |
| 401 Unauthorized          | <p>{ <br>    "error": "Session expired or incorrect credentials" <br>} </p>                                                                                                                                                                                                                                                                                                  | <p>Error! The JSESSIONID is absent, incorrect or expired. </p><p>error – text message, describes the error reason </p>                                                                                                                                                                                       |
| 500 Internal Server Error | <p>{ <br>    stack: \[ <br>        { <br>            "error": "some java exception" <br>            "trace": \[ <br>                "com.uniquid.servlet..... <br>                "com.uniquid.dao..... <br>                .... <br>             ] <br>        }, <br>        { …. }, <br>        …. <br>    ] <br>} </p>                                                   | <p>Error! Unexpected error. Must not appear in release version. </p><p>stack – array of cascade of exceptions <br>error – text message, describes the error reason <br>trace – the array of strings contains java trace for error. </p>                                                                      |

### Get info about specific device

Required the JSESSIONID in the request cookies, user must be logged in (see: Login API)&#x20;

The API returns information about the specific device.. To use this API – User must be logged on.&#x20;

* If success – API returns a JSON array containing just one item in the response body.  &#x20;
* If there is no device with given xpub – then return http code 404 Not found with error description&#x20;
* If the JSESSIONID is absent, incorrect or expired, then return http code 401 Unauthorized with the error description in the response body.&#x20;
* If an exception throws during the process – then return http code 500 Internal server error with the reason description of error.&#x20;

Request:

| **METHOD** | **REQUEST**           | **BODY/HEADERS**                    |
| ---------- | --------------------- | ----------------------------------- |
| GET        | /api/v1/devices/:xpub | Cookie: JSESSIONID=298zf09hf012fh2; |

Response:

| **HTTP CODE**             | **BODY**                                                                                                                                                                                                                                                                                                                   | **MEANING**                                                                                                                                                                                                                                                                                                 |
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 200 OK                    | <p>{ <br>   "name":" dev\_name\_1", <br>   "xpub": "pub\_key\_1", <br>   "recipe": "test", <br>   "contracts": 1, <br>   "shared": false <br>} </p>                                                                                                                                                                        | <p>Success! </p><p>name – name of the device <br>xpub – public key of the device <br>recipe - is always "test" <br>contracts – number of contracts involving this device. Is always 1 <br>shared – flag indicates if this is Shared Device; provided for future evolution. Always false in this version</p> |
| 404 Not found             | <p>{ <br>   "error": "Device with xpub: 'af3J42if4828c2' not found" <br>} </p>                                                                                                                                                                                                                                             | <p>Error! Orchestrator have no device with given xpub </p><p>error – text message, describes the error reason </p>                                                                                                                                                                                          |
| 401 Unauthorized          | <p>{ <br>    "error": "Session expired or incorrect credentials" <br>} </p>                                                                                                                                                                                                                                                | <p>Error! The JSESSIONID is absent, incorrect or expired. <br><br>error – text message, describes the error reason </p>                                                                                                                                                                                     |
| 500 Internal Server Error | <p>{ <br>    stack: \[ <br>        { <br>            "error": "some java exception" <br>            "trace": \[ <br>                "com.uniquid.servlet..... <br>                "com.uniquid.dao..... <br>                .... <br>             ] <br>        }, <br>        { …. }, <br>        …. <br>    ] <br>} </p> | <p>Error! Unexpected error. Must not appear in release version. </p><p>stack – array of cascade of exceptions <br>error – text message, describes the error reason <br>trace – the array of strings contains java trace for error. </p>                                                                     |

### Get list of access contracts

Required the JSESSIONID in the request cookies, user must be logged in (see: Login API)&#x20;

The API returns a list of all the Access Contracts of current tenant. To use this API – User must be logged on.&#x20;

* If success – API returns a JSON array containing all the access contracts in the response body. &#x20;
* If the JSESSIONID is absent, incorrect or expired, then return http code 401 Unauthorized with the error description in the response body. &#x20;
* If an exception throws during the process – then return http code 500 Internal server error with the reason description of error.&#x20;

Request:

| **METHOD** | **REQUEST**       | **BODY/HEADERS**                    |
| ---------- | ----------------- | ----------------------------------- |
| GET        | /api/v1/contracts | Cookie: JSESSIONID=298zf09hf012fh2; |

Response:

| **HTTP CODE**             | **BODY**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | **MEANING**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 200 OK                    | <p>\[<br>   {<br>      "provider":<br>           {<br>                "name":"device\_name\_1",<br>                "xpub":"device\_xpub",<br>                "address":"device\_address\_1"<br>            },<br>      "user":<br>           {<br>                "name":"device\_name\_2",<br>                "xpub":"device\_xpub\_2",<br>                "address":"device\_address\_2"<br>            },<br>      "revoker":<br>            {<br>                "name":"device\_name\_3",<br>                "xpub":"device\_xpub\_3",<br>                "address":"device\_address\_3"<br>            },<br>      "txid":"txid",<br>      "recipe":"Access",<br>      "status":"ACTIVE",<br>      "timestamp":123456789,<br>      "functions": \[34,35],<br>      "shared": false<br>   },<br>   …<br>] </p> | <p>Success!</p><p>provider – provider device information<br>user – user device information<br>revoker – revoker device information<br>txid – unique identifier of the transaction<br>recipe – is always "Access"<br>status – status of the contract. It can be 'pending', 'active' or 'revoked'<br>timestamp – creation time of the contract<br>functions – functionality enabled by the "provider" to the "user"<br>shared – flag indicates if this is Shared Contract; provided for future evolution. Always false in this version</p> |
| 401 Unauthorized          | <p>{<br>    "error": "Session expired or incorrect credentials"<br>} </p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | <p>Error! The JSESSIONID is absent, incorrect or expired.</p><p>error – text message, describes the error reason </p>                                                                                                                                                                                                                                                                                                                                                                                                                    |
| 500 Internal Server Error | <p>{<br>    stack: \[<br>        {<br>            "error": "some java exception"<br>            "trace": \[<br>                "com.uniquid.servlet.....<br>                "com.uniquid.dao.....<br>                ....<br>             ]<br>        },<br>        { …. },<br>        ….<br>    ]<br>} </p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | <p>Error! Unexpected error. Must not appear in release version.</p><p>stack – array of cascade of exceptions<br>error – text message, describes the error reason<br>trace – the array of strings contains java trace for error. </p>                                                                                                                                                                                                                                                                                                     |

### Create new Access Contract

Required the JSESSIONID in the request cookies, user must be logged in (see: Login API)&#x20;

The API creates a new Access Contract between devices provider and user. This API allows to create contract and if both devices belongs to current tenant. To use this API - User must be logged on.&#x20;

* If success – API returns http code 200 OK&#x20;
* If the JSESSIONID is absent, incorrect or expired, then return http code 401 Unauthorized with the error description in the response body. &#x20;
* If request body is empty – API returns http code 400 Bad request, with error description.
* If provider does not exist in orchestrator database – API returns http code 404 Provider with given Xpub not found.
* If user does not exist in orchestrator database – API returns http code 404 User with given Xpub not found.
* If an exception throws during the process – then return http code 500 Internal server error with the reason description of error.&#x20;

Request:

| **METHOD** | **REQUEST**       | **BODY/HEADERS**                                                                                                                                                                                                                                       |
| ---------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| POST       | /api/v1/contracts | <p>{<br>    "provider":"device\_xpub",<br>    "user":"device\_xpub",<br>    "functions": \[34,35]<br>}</p><p>"functions" is optional. If not set, then the orchestrator will allow functions 33 to 37. </p><p>Cookie: JSESSIONID=298zf09hf012fh2; </p> |

Response:

| **HTTP CODE**                                                  | **BODY**                                                                                                                                                                                                                                                                                                      | **MEANING**                                                                                                                                                                                                                           |
| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 200 OK                                                         |                                                                                                                                                                                                                                                                                                               | Success!                                                                                                                                                                                                                              |
| 401 Unauthorized                                               | <p>{<br>    "error": "Session expired or incorrect credentials"<br>} </p>                                                                                                                                                                                                                                     | <p>Error! The JSESSIONID is absent, incorrect or expired.</p><p>error – text message, describes the error reason </p>                                                                                                                 |
| 400 Bad request                                                | <p>{<br>    "error": "Body can't be empty"<br>} </p>                                                                                                                                                                                                                                                          | <p>Error! Client provide incorrect request.</p><p>error – text message, describes the error reason </p>                                                                                                                               |
| 404 Not found                                                  | <p>{<br>    "error": "Provider with given Xpub not found"<br>}</p>                                                                                                                                                                                                                                            | <p>Error! There is no provider with given Xpub in database of Orchestrator</p><p>error – text message, describes the error reason</p>                                                                                                 |
| <p>{<br>    "error": "User with given Xpub not found"<br>}</p> | <p>Error! There is no user with given Xpub in database of Orchestrator</p><p>error – text message, describes the error reason</p>                                                                                                                                                                             |                                                                                                                                                                                                                                       |
| 500 Internal Server Error                                      | <p>{<br>    stack: \[<br>        {<br>            "error": "some java exception"<br>            "trace": \[<br>                "com.uniquid.servlet.....<br>                "com.uniquid.dao.....<br>                ....<br>             ]<br>        },<br>        { …. },<br>        ….<br>    ]<br>} </p> | <p>Error! Unexpected error. Must not appear in release version. </p><p>stack – array of cascade of exceptions<br>error – text message, describes the error reason<br>trace – the array of strings contains java trace for error. </p> |

### Delete an Access Contract

Required the JSESSIONID in the request cookies, user must be logged in (see: Login API)&#x20;

The API deletes existing Access Contract. To use this API – User must be logged on.&#x20;

* If success – API returns http code 200 OK&#x20;
* If the JSESSIONID is absent, incorrect or expired, then return http code 401 Unauthorized with the error description in the response body.&#x20;
* If contract with given txid not exist – then return http code 404 Not found &#x20;
* If an exception throws during the process – then return http code 500 Internal server error with the reason description of error.&#x20;

Request:

| **METHOD** | **REQUEST**             | **BODY/HEADERS**                    |
| ---------- | ----------------------- | ----------------------------------- |
| DELETE     | /api/v1/contracts/:txid | Cookie: JSESSIONID=298zf09hf012fh2; |

Response:

| **HTTP CODE**             | **BODY**                                                                                                                                                                                                                                                                                                                                                          | **MEANING**                                                                                                                                                                                                                                   |
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 200 OK                    |                                                                                                                                                                                                                                                                                                                                                                   | Success!                                                                                                                                                                                                                                      |
| 401 Unauthorized          | <p>{ </p><p>    "error": "Session expired or incorrect credentials" </p><p>} </p>                                                                                                                                                                                                                                                                                 | <p>Error! The JSESSIONID is absent, incorrect or expired. </p><p>error – text message, describes the error reason </p>                                                                                                                        |
| 404 Not found             | <p>{ </p><p>    "error": "Contract not found" </p><p>} </p>                                                                                                                                                                                                                                                                                                       | <p>Error! Resource not found. </p><p>error – text message, describes the error reason </p>                                                                                                                                                    |
| 500 Internal Server Error | <p>{ </p><p>    stack: \[ </p><p>        { </p><p>            "error": "some java exception" </p><p>            "trace": \[ </p><p>                "com.uniquid.servlet..... </p><p>                "com.uniquid.dao..... </p><p>                .... </p><p>             ] </p><p>        }, </p><p>        { …. }, </p><p>        …. </p><p>    ] </p><p>} </p> | <p>Error! Unexpected error. Must not appear in release version. </p><p>stack – array of cascade of exceptions </p><p>error – text message, describes the error reason </p><p>trace – the array of strings contains java trace for error. </p> |

### Get Orchestrator info

Required the JSESSIONID in the request cookies, user must be logged in (see: Login API)&#x20;

The API returns the information about the current Orchestrator. User must be logged on.&#x20;

* If success – API returns the information about the current Orchestrator in the content body and http code 200 OK&#x20;
* If the request has extra path – method returns http code 400 Bad request with "path not implemented" in the content body.&#x20;
* If the JSESSIONID is absent, incorrect or expired, then return http code 401 Unauthorized with the error description in the response body. &#x20;
* If an exception throws during the process – then return http code 500 Internal server error with the reason description of error.&#x20;

Request:

| **METHOD** | **REQUEST**  | **BODY/HEADERS**                    |
| ---------- | ------------ | ----------------------------------- |
| GET        | /api/v1/info | Cookie: JSESSIONID=298zf09hf012fh2; |

Response:

| **HTTP CODE**             | **BODY**                                                                                                                                                                                                                                                                                                                                                          | **MEANING**                                                                                                                                                                                                                                                                                                    |
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 200 OK                    | <p>{ </p><p>      "name":"OrchestratorNJI95H28R4TA", </p><p>      "publicKey": "tpubDBYT1CEYNPzH9AveZd55....", </p><p>      "providerBalance":0, </p><p>      "userBalance":0, </p><p>      "topupAddress":"mkZusM4szmV7pkWYDvdVTHk28Jm..." </p><p>} </p>                                                                                                         | <p>Success! </p><p>name – name of the Orchestrator </p><p>publicKey – Orchestrator’s public key </p><p>providerBalance – coin balance of the "provider" bip32 hierarchy </p><p>userBalance – coin balance of the "user" bip32 hierarchy </p><p>topupAddress – address to use to recharge the Orchestrator </p> |
| 400 bad request           | Path not implemented                                                                                                                                                                                                                                                                                                                                              | Error! Extra path information not permitted                                                                                                                                                                                                                                                                    |
| 401 Unauthorized          | <p>{ </p><p>    "error": "Session expired or incorrect credentials" </p><p>} </p>                                                                                                                                                                                                                                                                                 | <p>Error! The JSESSIONID is absent, incorrect or expired. </p><p>error – text message, describes the error reason </p>                                                                                                                                                                                         |
| 500 Internal Server Error | <p>{ </p><p>    stack: \[ </p><p>        { </p><p>            "error": "some java exception" </p><p>            "trace": \[ </p><p>                "com.uniquid.servlet..... </p><p>                "com.uniquid.dao..... </p><p>                .... </p><p>             ] </p><p>        }, </p><p>        { …. }, </p><p>        …. </p><p>    ] </p><p>} </p> | <p>Error! Unexpected error. Must not appear in release version. </p><p>stack – array of cascade of exceptions </p><p>error – text message, describes the error reason </p><p>trace – the array of strings contains java trace for error. </p>                                                                  |

### Get Orchestrator properties

Required the JSESSIONID in the request cookies, user must be logged in (see: Login API)&#x20;

The API allows to list the properties of the current Orchestrator. User must be logged on.&#x20;

* If success – API returns the properties of the current Orchestrator in the content body and http code 200 OK&#x20;
* If the JSESSIONID is absent, incorrect or expired, then return http code 401 Unauthorized with the error description in the response body. &#x20;
* If an exception throws during the process – then return http code 500 Internal server error with the reason description of error.&#x20;

Request:

| **METHOD** | **REQUEST**        | **BODY/HEADERS**                    |
| ---------- | ------------------ | ----------------------------------- |
| GET        | /api/v1/properties | Cookie: JSESSIONID=298zf09hf012fh2; |

Response:

| **HTTP CODE**             | **REQUEST**                                                                                                                                                                                                                                                                                                                                                       | **MEANING**                                                                                                                                                                                                                                                                                  |
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 200 OK                    | <p>{ </p><p>   "network":"", </p><p>   "mqttTopic":"", </p><p>   "mqttBroker":"", </p><p>   "httpPort":"", </p><p>   "insightApiUrl":"", </p><p>   "registryUrl":"", </p><p>   "imprinterUrl":"" </p><p>} </p>                                                                                                                                                    | <p>Success! </p><p>network – blockchain network </p><p>mqttTopic – listening topic  </p><p>mqttBroker – broker for MQTT communication </p><p>insightApiUrl – blockchain API service </p><p>registryUrl – URL of the registry service </p><p>imprinterUrl – URL of the imprinter service </p> |
| 401 Unauthorized          | <p>{ </p><p>   "error": "Session expired or incorrect credentials" </p><p>} </p>                                                                                                                                                                                                                                                                                  | <p>Error! The JSESSIONID is absent, incorrect or expired. </p><p>error – text message, describes the error reason </p>                                                                                                                                                                       |
| 500 Internal Server Error | <p>{ </p><p>    stack: \[ </p><p>        { </p><p>            "error": "some java exception" </p><p>            "trace": \[ </p><p>                "com.uniquid.servlet..... </p><p>                "com.uniquid.dao..... </p><p>                .... </p><p>             ] </p><p>        }, </p><p>        { …. }, </p><p>        …. </p><p>    ] </p><p>} </p> | <p>Error! Unexpected error. Must not appear in release version. </p><p>stack – array of cascade of exceptions </p><p>error – text message, describes the error reason </p><p>trace – the array of strings contains java trace for error. </p>                                                |

### Update Orchestrator properties

Required the JSESSIONID in the request cookies, user must be logged in (see: Login API)&#x20;

The API allows to upload a settings file to the current Orchestrator. User must be logged on.&#x20;

* If success – API returns the information about the current Orchestrator in the content body and http code 200 OK&#x20;
* If the JSESSIONID is absent, incorrect or expired, then return http code 401 Unauthorized with the error description in the response body. &#x20;
* If request body is empty – API returns http code 400 Bad request, with error description&#x20;
* If an exception throws during the process – then return http code 500 Internal server error with the reason description of error.&#x20;

Request:

| **METHOD** | **REQUEST**        | **BODY/HEADERS**                                                  |
| ---------- | ------------------ | ----------------------------------------------------------------- |
| POST       | /api/v1/properties | <p>File to upload </p><p>Cookie: JSESSIONID=298zf09hf012fh2; </p> |

Response:

| **HTTP CODE**             | **BODY**                                                                                                                                                                                                                                                                                                                                                          | **MEANING**                                                                                                                                                                                                                                   |
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 200 OK                    |                                                                                                                                                                                                                                                                                                                                                                   | Success!                                                                                                                                                                                                                                      |
| 401 Unauthorized          | <p>{ </p><p>   "error": "Session expired or incorrect credentials" </p><p>} </p>                                                                                                                                                                                                                                                                                  | <p>Error! The JSESSIONID is absent, incorrect or expired. </p><p>error – text message, describes the error reason </p>                                                                                                                        |
| 400 Bad request           | <p>{ </p><p>    "error": "Body can't be empty" </p><p>} </p>                                                                                                                                                                                                                                                                                                      | <p>Error! Client provide incorrect request. </p><p>error – text message, describes the error reason </p>                                                                                                                                      |
| 500 Internal Server Error | <p>{ </p><p>    stack: \[ </p><p>        { </p><p>            "error": "some java exception" </p><p>            "trace": \[ </p><p>                "com.uniquid.servlet..... </p><p>                "com.uniquid.dao..... </p><p>                .... </p><p>             ] </p><p>        }, </p><p>        { …. }, </p><p>        …. </p><p>    ] </p><p>} </p> | <p>Error! Unexpected error. Must not appear in release version. </p><p>stack – array of cascade of exceptions </p><p>error – text message, describes the error reason </p><p>trace – the array of strings contains java trace for error. </p> |

### Init Orchestrator

No special authentication requirements for this API call&#x20;

The API initialize orchestrator (set organization). This organization needs to start working orchestrator and use to communicate between another components of the system. The Init method can be called only once at the beginning. All other APIs couldn't be called before the Init call.&#x20;

* If success – API returns https code 200 OK.&#x20;
* If request body is empty – API returns http code 400 Bad request, with error description&#x20;
* If any other exception throws during the init orchestrator process – then return http code 500 Internal server error with the reason description of error.&#x20;

Request:

| **METHOD** | **REQUEST**  | **BODY/HEADERS**                                 |
| ---------- | ------------ | ------------------------------------------------ |
| POST       | /api/v1/init | <p>{ </p><p>    "orgId": "pepsico" </p><p>} </p> |

Response:

| **HTTP CODE**             | **BODY**                                                                                                                                                                                                                                                                                                                                                          | **MEANING**                                                                                                                                                                                                                                   |
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 200 OK                    |                                                                                                                                                                                                                                                                                                                                                                   | Success!                                                                                                                                                                                                                                      |
| 403 Forbidden             | <p>{ </p><p>   "error": "Settings already initialized" </p><p>} </p>                                                                                                                                                                                                                                                                                              | <p>Error! The Orchestrator already initialized. The second call of Init not allowed. </p><p>error – text message, describes the error reason </p>                                                                                             |
| 400 Bad request           | <p>{ </p><p>    "error": "Body can't be empty" </p><p>} </p>                                                                                                                                                                                                                                                                                                      | <p>Error! Client provide incorrect request. </p><p>error – text message, describes the error reason </p>                                                                                                                                      |
| 500 Internal Server Error | <p>{ </p><p>    stack: \[ </p><p>        { </p><p>            "error": "some java exception" </p><p>            "trace": \[ </p><p>                "com.uniquid.servlet..... </p><p>                "com.uniquid.dao..... </p><p>                .... </p><p>             ] </p><p>        }, </p><p>        { …. }, </p><p>        …. </p><p>    ] </p><p>} </p> | <p>Error! Unexpected error. Must not appear in release version. </p><p>stack – array of cascade of exceptions </p><p>error – text message, describes the error reason </p><p>trace – the array of strings contains java trace for error. </p> |
