# Organizations

## Create Organization

<mark style="color:orange;">`PUT`</mark> `https://identity.vulos.io/api/v1/organization/create`

Create a new organization.

#### Headers

| Name                                            | Type   | Description                                                               |
| ----------------------------------------------- | ------ | ------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer authentication with the access token obtained using OpenID Connect |

#### Request Body

| Name                                          | Type   | Description                                                                              |
| --------------------------------------------- | ------ | ---------------------------------------------------------------------------------------- |
| name<mark style="color:red;">\*</mark>        | String | The name of the organization                                                             |
| website                                       | String | The website of the organization                                                          |
| address<mark style="color:red;">\*</mark>     | String | The address where the organization is located at                                         |
| uniqueId<mark style="color:red;">\*</mark>    | String | A unique identifier that the organization has been registered with (for example: an OUI) |
| taxNumber<mark style="color:red;">\*</mark>   | String | The organization's tax number                                                            |
| city<mark style="color:red;">\*</mark>        | String | The city where the organization is located at                                            |
| countryCode<mark style="color:red;">\*</mark> | String | The two-letter country code where the organization is located at                         |
| zipCode<mark style="color:red;">\*</mark>     | String | The zip / postal code where the organization is located at                               |
| state                                         | String | The state where the organization is located at                                           |

{% tabs %}
{% tab title="200: OK A reference to the organization that was created" %}

```javascript
{ organizationId: 1, membershipId: "<guid>", userId: "<guid>" }
```

{% endtab %}

{% tab title="400: Bad Request Error response" %}

```javascript
{
    "error": "Something went wrong",
    "code": "<errror code>",
    "request": "<request id>"
}
```

{% endtab %}

{% tab title="401: Unauthorized Empty body" %}

```javascript
```

{% endtab %}
{% endtabs %}

## Organization List

<mark style="color:blue;">`GET`</mark> `https://identity.vulos.io/api/v1/organization/list`

Get all organizations for the authenticated user.

#### Headers

| Name                                            | Type   | Description                                                               |
| ----------------------------------------------- | ------ | ------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer authentication with the access token obtained using OpenID Connect |

{% tabs %}
{% tab title="401: Unauthorized Authorization failed" %}

```javascript
```

{% endtab %}

{% tab title="200: OK A list of organization memberships" %}

```javascript
[
    { organizationId: 1, membershipId: "<guid>", userId: "<guid>" },
    { organizationId: 2, membershipId: "<guid>", userId: "<guid>" },
]
```

{% endtab %}

{% tab title="400: Bad Request Invalid permissions or resource" %}

```javascript
{
    "error": "Something went wrong",
    "code": "<errror code>",
    "request": "<request id>"
}
```

{% endtab %}
{% endtabs %}

## Organization Info

<mark style="color:blue;">`GET`</mark> `https://identity.vulos.io/api/v1/organization/:id`

Get information about a specific organization.

#### Path Parameters

| Name                                 | Type   | Description                |
| ------------------------------------ | ------ | -------------------------- |
| id<mark style="color:red;">\*</mark> | Number | The ID of the organization |

#### Headers

| Name                                            | Type   | Description                                                               |
| ----------------------------------------------- | ------ | ------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer authentication with the access token obtained using OpenID Connect |

{% tabs %}
{% tab title="401: Unauthorized Empty body" %}

```javascript
```

{% endtab %}

{% tab title="200: OK Information about the organization" %}

```json
{
    "memberships": [
        { organizationId: 2, membershipId: "<guid>", userId: "<guid>" },
        { organizationId: 2, membershipId: "<guid>", userId: "<guid>" },
    ],
    "id": 2,
    "name": "Example Organization",
    "website": "https://example.com",
    "address": "Example Address",
    "uniqueId": "<organization unique id>",
    "taxNumber": "<organization tax number>",
    "city": "Example City",
    "country": {
        "alpha2": "AQ",
        "name": "Antartica"
    },
    "zipCode": "<organization zip code>",
    "state": "<optional state>",
    "verified": false
}
```

{% endtab %}

{% tab title="400: Bad Request Error response" %}

```javascript
{
    "error": "Something went wrong",
    "code": "<errror code>",
    "request": "<request id>"
}
```

{% endtab %}
{% endtabs %}

## Update Organization

<mark style="color:orange;">`PUT`</mark> `https://identity.vulos.io/api/v1/organization/:id/update`

Update a specific organization's details.

#### Path Parameters

| Name                                 | Type   | Description                |
| ------------------------------------ | ------ | -------------------------- |
| id<mark style="color:red;">\*</mark> | Number | The ID of the organization |

#### Headers

| Name                                            | Type   | Description                                                               |
| ----------------------------------------------- | ------ | ------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer authentication with the access token obtained using OpenID Connect |

#### Request Body

| Name        | Type    | Description                                                                               |
| ----------- | ------- | ----------------------------------------------------------------------------------------- |
| name        | String  | The name of the organization                                                              |
| website     | String  | The website of the organization                                                           |
| address     | String  | The address where the organization is located at                                          |
| uniqueId    | String  | A unique identifier that the organization has been registered with (for example: an  OUI) |
| taxNumber   | String  | The organization's tax number                                                             |
| city        | String  | The city where the organization is located at                                             |
| countryCode | Alpha 2 | The two-letter country code where the organization is located at                          |
| zipCode     | String  | The zip / postal code where the organization is located at                                |
| state       | String  | The state where the organization is located at                                            |

{% tabs %}
{% tab title="200: OK Success message" %}

```javascript
{
     "success": true,
     "message": "A message describing the successful response"
}
```

{% endtab %}

{% tab title="400: Bad Request Error response" %}

```javascript
{
    "error": "Something went wrong",
    "code": "<errror code>",
    "request": "<request id>"
}
```

{% endtab %}

{% tab title="401: Unauthorized Empty body" %}

```javascript
```

{% endtab %}
{% endtabs %}

## Delete Organization

<mark style="color:red;">`DELETE`</mark> `https://identity.vulos.io/api/v1/organization/:id/delete`

Delete an organization.

#### Path Parameters

| Name                                 | Type   | Description                |
| ------------------------------------ | ------ | -------------------------- |
| id<mark style="color:red;">\*</mark> | Number | The ID of the organization |

#### Headers

| Name                                            | Type   | Description                                                               |
| ----------------------------------------------- | ------ | ------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer authentication with the access token obtained using OpenID Connect |

{% tabs %}
{% tab title="200: OK Success message" %}

```javascript
{
     "success": true,
     "message": "A message describing the successful response"
}
```

{% endtab %}

{% tab title="400: Bad Request Error response" %}

```javascript
{
    "error": "Something went wrong",
    "code": "<errror code>",
    "request": "<request id>"
}
```

{% endtab %}

{% tab title="401: Unauthorized Empty body" %}

```javascript
```

{% endtab %}
{% endtabs %}
