> For the complete documentation index, see [llms.txt](https://docs.blynk.io/en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.blynk.io/en/blynk.cloud/platform-https-api/oauth.md).

# 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":{"OAuthScope":{"type":"string","description":"A single OAuth2 client scope.\n\nThe two top level API types (`PLATFORM_API`, `MQTT_GATEWAY_API`) and the voice integrations\n(`ALEXA`, `GOOGLE_HOME`) enable the corresponding API for the client, while\n`CLIENT_CREDENTIALS` and `USER_CREDENTIALS` define the OAuth2 grant types the client may use.\n\nThe rest of the scopes are the Platform API endpoint scopes, grouped per API group. Every group\nhas two group wide levels: `<GROUP>_ALL` grants every endpoint of the group, including the ones\nadded to the group in the future, and `<GROUP>_GET_ONLY` grants only the `GET` endpoints of the\ngroup. Individual endpoint scopes may be granted instead of a group wide level.\n","enum":["PLATFORM_API","MQTT_GATEWAY_API","ALEXA","GOOGLE_HOME","CLIENT_CREDENTIALS","USER_CREDENTIALS","ORGANIZATIONS_ALL","ORGANIZATIONS_GET_ONLY","ORGANIZATION_GET","ORGANIZATION_PROFILE_GET","SUB_ORGANIZATIONS_GET","ORGANIZATIONS_SEARCH_GET","ORGANIZATION_CREATE","ORGANIZATION_NAME_EDIT","ORGANIZATION_DELETE","ORGANIZATION_ROLES_GET","ORGANIZATION_ROLE_GET","DEVICES_ALL","DEVICES_GET_ONLY","DEVICES_GET","DEVICE_GET","DEVICES_LAST_ACTIVATED_GET","DEVICES_BY_OWNER_GET","DEVICES_BY_USER_ORG_GET","DEVICE_DATASTREAMS_GET","DEVICE_METAFIELD_GET","DEVICE_TAGS_GET","DEVICE_TIMELINE_GET","DEVICE_LOGS_GET","DEVICE_ONLINE_STATUS_GET","DEVICE_DATASTREAM_HISTORY_GET","DEVICES_SEARCH_GET","DEVICE_DATASTREAM_UPDATE","DEVICE_DATASTREAM_PROPERTY_UPDATE","DEVICE_METAFIELD_UPDATE","DEVICE_CREATE","DEVICE_EVENT_TRIGGER","DEVICE_EVENT_RESOLVE","DEVICE_TRANSFER","DEVICES_BATCH_UPDATE","DEVICE_EDIT","DEVICE_DELETE","DEVICE_DATA_CLEAR","DEVICE_OWNER_REMOVE","DEVICE_DATA_IMPORT","DEVICE_PARENT_SET","DEVICE_SET_LOCKED","TEMPLATES_ALL","TEMPLATES_GET_ONLY","TEMPLATES_GET","TEMPLATE_GET","TEMPLATE_METAFIELDS_GET","TEMPLATE_DATASTREAMS_GET","TEMPLATE_EVENTS_GET","TEMPLATE_CREATE","TEMPLATE_EDIT","TEMPLATE_DELETE","TEMPLATE_DATASTREAM_CREATE","TEMPLATE_DATASTREAM_EDIT","TEMPLATE_DATASTREAM_DELETE","TEMPLATE_EVENT_CREATE","TEMPLATE_EVENT_EDIT","TEMPLATE_EVENT_DELETE","USERS_ALL","USERS_GET_ONLY","USER_PROFILE_GET","USERS_GET","USER_GET","USERS_SEARCH_GET","USER_CREATE","USER_REGISTER","USER_INVITE","USER_SEND_PUSH_NOTIFICATION","USER_FCM_TOKEN_REGISTER","USER_TRANSFER","USER_ROLE_EDIT","USER_DEV_MODE_EDIT","PROVISIONING_ALL","PROVISIONING_GET_ONLY","PROVISION_TOKEN_CREATE","REPROVISION_TOKEN_CREATE","DEVICE_RECONFIGURE","STATIC_TOKENS_ALL","STATIC_TOKENS_GET_ONLY","STATIC_TOKENS_GET","STATIC_TOKENS_GENERATE","STATIC_TOKENS_UNCLAIM","STATIC_TOKENS_CLAIM","TAGS_ALL","TAGS_GET_ONLY","TAGS_GET","AUTOMATIONS_ALL","AUTOMATIONS_GET_ONLY","AUTOMATIONS_GET","AUTOMATION_GET","AUTOMATION_LOG_GET","AUTOMATION_CREATE","AUTOMATION_EDIT","AUTOMATION_DELETE","AUTOMATION_ENABLE","AUTOMATION_DISABLE","AUTOMATION_EXECUTE","AUTOMATION_CANCEL","WEBHOOKS_ALL","WEBHOOKS_GET_ONLY","WEBHOOKS_GET","WEBHOOK_GET","WEBHOOK_CREATE","WEBHOOK_EDIT","WEBHOOK_DELETE","SHIPMENTS_ALL","SHIPMENTS_GET_ONLY","SHIPMENTS_GET","SHIPMENT_GET","SHIPMENT_CREATE","SHIPMENT_STOP","SHIPMENT_DELETE","SHIPMENT_FLEETS_GET","SHIPMENT_FLEET_GET","SHIPMENT_FLEET_CREATE","SHIPMENT_FLEET_EDIT","SHIPMENT_FLEET_DELETE","SHIPMENTS_V2_GET","SHIPMENT_V2_GET","SHIPMENT_V2_CREATE","SHIPMENT_V2_EDIT","SHIPMENT_V2_DELETE","SHIPMENT_V2_START","SHIPMENT_V2_PAUSE","SHIPMENT_V2_STOP","SHIPMENT_V2_STAGE_MOVE","SHIPMENT_V2_DEVICE_EXCLUDE","SHIPMENT_V2_DEVICE_INCLUDE","SHIPMENT_V2_DEVICE_ATTEMPTS_RESET","OAUTH_ALL","OAUTH_GET_ONLY","OAUTH_CLIENT_CREATE","DATA_ENGINE_ALL","DATA_ENGINE_GET_ONLY","DATA_ENGINE_QUERY","CUSTOM_DATA_ALL","CUSTOM_DATA_GET_ONLY","CUSTOM_DATA_ROW_GET","CUSTOM_DATA_ROWS_GET","CUSTOM_DATA_ROW_CREATE","CUSTOM_DATA_ROW_DELETE"]},"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"},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/OAuthScope"},"description":"Scopes granted to the client"}},"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"},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/OAuthScope"},"description":"Scopes granted to the created client. When omitted, the client is granted every scope.\n"}},"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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.blynk.io/en/blynk.cloud/platform-https-api/oauth.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
