> **Source:** https://knowledge.leegality.com/sign-station/api/toggle-o-auth-2-client-state > **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 --- # PATCH /api/v1/oauth2-clients/{id}/toggle-state — Toggle OAuth2 client state Toggles OAuth2 client state between ACTIVE and SUSPENDED for the current user's organization **Authentication:** `X-Auth-Token` header required on every request. ## Request URL ``` PATCH https://app1.leegality.com/api/api/v1/oauth2-clients/{id}/toggle-state ``` **Environments:** - Production: `https://app1.leegality.com/api/api/v1/oauth2-clients/{id}/toggle-state` - Sandbox: `https://sandbox.leegality.com/api/api/v1/oauth2-clients/{id}/toggle-state` --- ## Parameters | Name | In | Required | Type | Description | Example | |------|----|----------|------|-------------|---------| | `id` | path | Yes | string | OAuth2 client ID of which you want to toggle the state. | — | --- ## Responses ### 200 — OAuth2 client state toggled successfully | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `code` | string | No | Response status code | `LE_SS_004` | | `message` | string | No | Response message | `OAuth2 client updated successfully.` | | `data` | OAuth2ClientToggleStateVO | No | See **OAuth2ClientToggleStateVO** below. | — | #### OAuth2ClientToggleStateVO | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `id` | string | No | OAuth2 client unique identifier | `a3a0e830-66b6-4845-bf1a-91e0966fb97b` | | `clientId` | string | No | OAuth2 client identifier | `FinanceTest` | | `state` | string | No | OAuth2 client state Allowed: `ACTIVE`, `SUSPENDED`. | `SUSPENDED` | | `createdAt` | string | No | The date and time when the OAuth2 client was created | `2025-12-22T16:26:03` | ### 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` | ### 404 — OAuth2 client not found | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `code` | string | No | Top-level error code | `LE_ERR_SS_404` | | `errors` | array\ | No | List of error details See **ErrorDetailOAuth2Client404VO** below. | — | #### ErrorDetailOAuth2Client404VO | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `message` | string | No | Detailed error message | `OAuth2 Client with id a3a0e830-66b6-4845-bf1a-91e0966fb97a d` | | `path` | string | No | API path that generated the error | `/api/v1/oauth2-clients/a3a0e830-66b6-4845-bf1a-91e0966fb97a/` | | `code` | string | No | Specific error code | `LE_ERR_SS_001` | ### 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 (200) ```json { "code": "LE_SS_004", "message": "OAuth2 client updated successfully.", "data": { "id": "a3a0e830-66b6-4845-bf1a-91e0966fb97b", "clientId": "FinanceTest", "state": "SUSPENDED", "createdAt": "2025-12-22T16:26:03" } } ```