# Set or rotate this org’s OAuth application

> Source: https://elaichi.ai/docs/api-reference/connectors/connector/putconnectoroauthapp/

`PUT /connector/{slug}/oauth-app`

Resource: **Connector** · API: **Connectors**

## Path parameters

- **`slug`** _(string, required)_
  Connector slug.

## Request body

- **`client_id`** _(string)_
- **`client_secret`** _(string)_
  Omit to keep the stored secret. Never returned by any endpoint.
- **`scope`** _(array<string>)_
  Omit to keep the catalog scopes; an array overrides them wholesale.
- **`optional_scope`** _(array<string>)_
- **`user_scope`** _(string)_
  Space-separated authorize-URL scopes (`params.user_scope`).

## Response body

- **`oauth_app_mode`** _(string)_
  Which application connects on this connector use.
  Allowed: `platform_default`, `byoa`
- **`client_id`** _(string,null)_
- **`has_client_secret`** _(boolean)_
  Whether a secret is stored. The secret itself is never returned.
- **`scope`** _(array,null)_
  Scope overrides this org stored, or null when it kept the catalog scopes.
- **`optional_scope`** _(array,null)_
- **`user_scope`** _(string,null)_
  Space-separated authorize-URL scopes (`params.user_scope`), or null.
- **`updated_at`** _(string,null)_

## Code examples

### curl

```bash
curl -X PUT 'https://api.elaichi.ai/connector/<slug>/oauth-app' \
  -H 'Authorization: Bearer $ELAICHI_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"client_id":"your_client_id","client_secret":"your_client_secret","scope":[],"optional_scope":[],"user_scope":"your_user_scope"}'
```

### JavaScript

```javascript
const body = {
  "client_id": "your_client_id",
  "client_secret": "your_client_secret",
  "scope": [],
  "optional_scope": [],
  "user_scope": "your_user_scope"
};

const response = await fetch('https://api.elaichi.ai/connector/<slug>/oauth-app', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer ' + process.env.ELAICHI_API_TOKEN,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import os
import requests

url = "https://api.elaichi.ai/connector/<slug>/oauth-app"
headers = {
    "Authorization": f"Bearer {os.environ['ELAICHI_API_TOKEN']}",
    "Content-Type": "application/json",
}
payload = {
    "client_id": "your_client_id",
    "client_secret": "your_client_secret",
    "scope": [],
    "optional_scope": [],
    "user_scope": "your_user_scope"
}

response = requests.put(url, headers=headers, json=payload)
print(response.json())
```
