> **Source:** https://knowledge.leegality.com/sign-station/api/create-o-auth-2-client > **Site:** Leegality Knowledge Base — https://knowledge.leegality.com > **About:** Leegality is a document execution platform covering eSigning, stamps, NeSL, workflows, and REST API integration. > **Navigation:** Every article on this site has a plain-text version at `.txt` (this format). To get an index of all articles with their `.txt` links, read: https://knowledge.leegality.com/llms.txt > **AI Guide:** For instructions on how to navigate this knowledge base as an AI agent, read: https://knowledge.leegality.com/ai-readable.txt --- # POST /api/v1/oauth2-clients — Create new OAuth2 client Creates new OAuth2 client for the current user's organization **Authentication:** `X-Auth-Token` header required on every request. ## Request URL ``` POST https://app1.leegality.com/api/api/v1/oauth2-clients ``` **Environments:** - Production: `https://app1.leegality.com/api/api/v1/oauth2-clients` - Sandbox: `https://sandbox.leegality.com/api/api/v1/oauth2-clients` --- ## Request Body **Content-Type:** `application/json` OAuth2 client data to create | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `clientId` | string | Yes | OAuth2 client identifier | `HS1cVm1fLDctBGvAyiu76MIr9PfIqSAl0t2dKHkwWknost8nFh6J5HOiM3SD` | ### Sample Request ```json { "clientId": "HS1cVm1fLDctBGvAyiu76MIr9PfIqSAl0t2dKHkwWknost8nFh6J5HOiM3SDM" } ``` --- ## Responses ### 201 — OAuth2 client created successfully | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `code` | string | No | Response status code | `LE_SS_001` | | `message` | string | No | Response message | `Your changes have been successfully saved.` | | `data` | OAuth2ClientVO | No | See **OAuth2ClientVO** below. | — | #### OAuth2ClientVO | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `id` | string | No | OAuth2 client unique identifier | `8c18cc0b-6251-490e-82ac-dfde6f4735c1` | | `clientId` | string | No | OAuth2 client identifier | `HS1cVm1fLDctBGvAyiu76MIr9PfIqSAl0t2dKHkwWknost8nFh6J5HOiM3SD` | | `clientSecret` | string | No | OAuth2 client secret | `SR2KJGnlodwZWBUNBubPRNYSqCW_TUTD4A8Vhf1t2aM` | | `state` | string | No | OAuth2 client state Allowed: `ACTIVE`, `SUSPENDED`. | `ACTIVE` | | `createdAt` | string | No | The date and time when the OAuth2 client was created | `2025-12-29T15:43:17.528673` | ### 400 — Invalid request data | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `code` | string | No | Top-level error code | `LE_ERR_SS_400` | | `errors` | array\ | No | List of error details See **ErrorDetailOAuth2Client400VO** below. | — | #### ErrorDetailOAuth2Client400VO | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `message` | string | No | Detailed error message | `Invalid value for field [clientId], Client ID must be 6-64 c` | | `path` | string | No | API path that generated the error | `/api/v1/oauth2-clients` | ### 401 — Unauthorized - Invalid or expired token | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `code` | string | No | Top-level error code | `LE_ERR_SS_401` | | `errors` | array\ | No | List of error details See **ErrorDetail401Unauthorized** below. | — | #### ErrorDetail401Unauthorized | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `message` | string | No | Detailed error message | `Invalid or expired token` | | `path` | string | No | API path that generated the error | `/api/v1/*` | | `code` | string | No | Specific error code | `LE_ERR_SS_303` | ### 409 — OAuth2 client already exists | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `code` | string | No | Top-level error code | `LE_ERR_SS_409` | | `errors` | array\ | No | List of error details See **ErrorDetailOAuth2Client409VO** below. | — | #### ErrorDetailOAuth2Client409VO | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `message` | string | No | Detailed error message | `OAuth2 client with ID 'QTw1RK-0lKoycG82K1S_V7O8Fs0YPQIoGJD7'` | | `path` | string | No | API path that generated the error | `/api/v1/oauth2-clients` | | `code` | string | No | Specific error code | `LE_ERR_SS_010` | ### 500 — Internal server error | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `code` | string | No | Top-level error code | `LE_ERR_SS_500` | | `errors` | array\ | No | List of error details See **ErrorDetailToken500VO** below. | — | #### ErrorDetailToken500VO | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `message` | string | No | Detailed error message | `Internal Server Error` | | `path` | string | No | API path that generated the error | `null` | | `code` | string | No | Specific error code | `null` | ### Sample Response (201) ```json { "code": "LE_SS_001", "message": "Your changes have been successfully saved.", "data": { "id": "8c18cc0b-6251-490e-82ac-dfde6f4735c1", "clientId": "HS1cVm1fLDctBGvAyiu76MIr9PfIqSAl0t2dKHkwWknost8nFh6J5HOiM3SDM", "clientSecret": "SR2KJGnlodwZWBUNBubPRNYSqCW_TUTD4A8Vhf1t2aM", "state": "ACTIVE", "createdAt": "2025-12-29T15:43:17.528673" } } ```