# OAuth

OAuth2 client management

## Create OAuth client

> Create a new OAuth2 client application.\
> \
> Required permissions, when user-scoped authentication is used: \`OAUTH\_TOKEN\_CREATE\`.\
> Also, when the user-scoped authentication is used, user should have developer mode enabled.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"OAuth","description":"OAuth2 client management"}],"servers":[{"url":"https://{server_address}","description":"Blynk Server","variables":{"server_address":{"default":"blynk.cloud","description":"Your Blynk server domain"}}}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth2 Bearer token obtained from authentication endpoint"}},"schemas":{"OAuthClient":{"type":"object","properties":{"orgId":{"type":"integer","format":"int32","description":"Organization ID, that the client belongs to"},"name":{"type":"string","description":"Client application name"},"clientId":{"type":"string","description":"OAuth client ID"},"secret":{"type":"string","description":"OAuth client secret"},"redirectUrls":{"type":"array","items":{"type":"string"},"description":"Allowed redirect URIs"}},"required":["orgId","name","clientId","secret"]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/oauth/clients/create":{"post":{"tags":["OAuth"],"summary":"Create OAuth client","description":"Create a new OAuth2 client application.\n\nRequired permissions, when user-scoped authentication is used: `OAUTH_TOKEN_CREATE`.\nAlso, when the user-scoped authentication is used, user should have developer mode enabled.\n","operationId":"createOAuthClient","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"orgId":{"type":"integer","format":"int32","description":"Organization ID, in which OAuth client will be created. If not provided, the organization, that is associated with the authentication token, will be used."},"name":{"type":"string","minLength":1,"maxLength":64,"description":"Client application name"},"redirectUrls":{"type":"array","items":{"type":"string","format":"uri","maxLength":1024},"maxItems":10,"description":"Redirect URIs"}},"required":["name"]}}}},"responses":{"201":{"description":"OAuth client created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthClient"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Organization not found or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```


---

# 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://docs.blynk.io/en/blynk.cloud/platform-https-api/oauth.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.
