# Organization Client

In order to get an access token from the Switch Authorization Server, you need to pass valid **client ID** and **client secret** in the request as explained in [Client Credentials Flow](/switch-api/authentication/client-credentials-flow.md). For this purpose you need to create an Organization Client.

The Switch app offers a way for the organization administrators to manage their organization clients, such as view, and delete existing clients, create new clients and manage each client secrets.

## Manage Clients

### View clients

Follow the steps below to see your organization clients and their respective IDs.

1. In the upper-right corner of any page in the Switch app, click the **User** icon, then click on the organization for which you wish to see the clients for.\
   \
   ![](/files/V93nFyo7Yg9054Q7xCpx)
2. Next, in the upper-right corner of any page on Switch app, click the **Settings** icon, then click **My organization**.\
   \
   ![](/files/OQmX4vvuFromuLEBIa8F)
3. Next, in the left sidebar menu click **API**.\
   \
   ![](/files/uHPv8ZPO9dOdSOsLDFDE)
4. List of existing organization clients with their respective client IDs will be shown on the right, under the **Clients** tab.<br>

   <figure><img src="/files/qp0YMZoJX2LoJ1pfUOSS" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
In case there are no existing organization clients available for the organization, an empty list will be shown. In this case just proceed to the next topic about creating new organization client.
{% endhint %}

### Create client

To create new organization client you first need to be on the [View clients](#view-clients) page as explained above and follow the steps below.

1. Click on the **Create client** button on the right.<br>

   <figure><img src="/files/DmluHWy9tNTDAv7gWyYi" alt=""><figcaption></figcaption></figure>
2. Next, enter the client **Name**, select which roles the client should have from the list of **Available roles,** and click the **Save** button in the bottom-right.<br>

   <figure><img src="/files/wlB8SlkbhzUXpjBpUqMk" alt=""><figcaption></figcaption></figure>
3. After saving, the newly created client with its respective **client ID** and **client secret** will be shown in the list of existing clients. Remember that the client secret is shown and can be copied at this stage only and after you refresh the page you will not have that possibility again.<br>

   <figure><img src="/files/V7mmYvkiKgn4pcmv6UBN" alt=""><figcaption></figcaption></figure>

### Rotate client secret

To rotate the client secret you need to be on the [View clients](#view-clients) page as explained above and follow the steps below.

1. Click on the rotate button right next to the secret hint of the client secret that you want to rotate and confirm the secret rotation.<br>

   <figure><img src="/files/Lj4OXIpYIZQ1N41RVYOI" alt=""><figcaption></figcaption></figure>
2. The secret will be rotated and the new value will be shown until you refresh the page, after which, you will be able to see only the secret hint.<br>

   <figure><img src="/files/qUfxiMPdp9vZoOUpO7ol" alt=""><figcaption></figcaption></figure>

### Delete client

To delete existing organization client you need to be on the [View clients](#view-clients) page as explained above and follow the steps below.

1. Click on the **Delete** button on the right of the client name, of the client you want to delete.<br>

   <figure><img src="/files/xYMwBlkzi1JQS1iMls3S" alt=""><figcaption></figcaption></figure>

{% hint style="danger" %}
By deleting a client, any application using this client will lose access to the Switch API.
{% endhint %}

### Client roles

The roles associated with organization client ensure which permissions the client will have when accessing the Switch API. It is important that you are aware of this when changing the roles to the organization client since you might lose some permissions that you require, or give some permissions that you did not intended to, depending on which roles you will select. To manage the assigned roles to a client you need to be on the [View clients](#view-clients) page as explained above and follow the steps below.

1. Click on the **pencil-like** edit icon below the client name, right next to list of assigned roles, after which the **Roles** popup window will be shown.<br>

   <figure><img src="/files/K2WSPPcqjJzxYWQZwpu3" alt=""><figcaption></figcaption></figure>
2. Select from the **Available roles** shown on the left to add/assign them with the client. Click on the **Selected roles** shown on the right to remove them from the client. Click on the **Save** button in the bottom-right to save the changes.<br>

   <figure><img src="/files/G1lp8fc5849sLCfAKHfJ" alt=""><figcaption></figcaption></figure>

{% hint style="danger" %}
By changing the client roles you potentially change the permissions that the client has and thus change what the client has access to.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.switchmarket.se/switch-api/authentication/organization-client.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
