> ## Documentation Index
> Fetch the complete documentation index at: https://developer.suki.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Content Rewrite Returns 400, 403, or 500

> Fix invalid_rewrite_content_request, content_rewrite_not_enabled, and rewrite 500s with request_id

[Rewrite content](/api-reference/content/rewrite) fails when the request fails validation, rewrite is not enabled for the partner or user, auth is wrong, or the server cannot load rewrite config or specialty. Match the error id (or message prefix) before you change credentials or UI write-back.

| Error id | HTTP | Meaning |
| :- | :- | :- |
| `invalid_rewrite_content_request` | 400 | Body failed validation (instruction, selection, lengths, or required `context`) |
| `content_rewrite_not_enabled` | 403 | Content rewrite is not enabled for this partner or user |
| `invalid_sdp_token` | 401 | Missing, expired, or invalid `sdp_suki_token` |
| `permission_denied` | 403 | General authorization failure |
| `invalid_or_missing_partner_id` | 403 | Partner ID missing or invalid in token claims |
| `failed_to_retrieve_partner` | 403 | Failed to retrieve partner details |
| `invalid_organization_or_user_claims` | 403 | Invalid organization ID or user ID claims |
| `provider_not_registered` | 401 | Clinician not registered via `/auth/register` |
| `provider_user_inactive` | 400 | Provider user is not active (Rewrite content uses **400**) |
| `failed_to_get_enable_content_rewrite_config` | 500 | Internal error loading rewrite entitlement config |
| `failed_to_get_user_specialty` | 500 | Internal error loading user specialty |
| Downstream mapped status | varies | Downstream rewrite failure with `<message> (request_id=…)` |

Messages for rewrite-specific rows often include `request_id=…`. Keep that value when you contact [Technical Support](mailto:support@suki.ai).

## Common causes

* `instruction` is not exactly **`CONCISE`**, **`VERBOSE`**, or **`PATIENT_FRIENDLY`**.
* `selected_text` is empty, longer than **1024** Unicode runes (default max), or `surrounding_content` exceeds the same max when set.
* `context` or `context.selection` is missing, or offsets violate `0 <= start <= end`.
* Rewrite is not enabled for the partner or clinician.
* Suki Token, Partner ID claims, or single-auth `sdp_provider_id` are wrong.
* The provider is not registered or not active.

## Fix

<Steps>
  <Step title="Keep Original Text and Chart Save">
    Do not clear the selection or block EHR save when rewrite fails. Retry only from the rewrite control. See [Rewrite Dictation content](/documentation/how-to/dictation/rewrite-dictation-content#handle-rewrite-failures).
  </Step>

  <Step title="Fix 400 Validation">
    Confirm `instruction`, required `context.selection`, `0 <= start <= end`, and length limits for `selected_text` and `surrounding_content`. Match the span to the offsets you send.
  </Step>

  <Step title="Fix 401 Auth">
    Refresh `sdp_suki_token`. For single\_auth, send a valid `sdp_provider_id`. If the message is `provider not registered`, register the clinician first. See [401 Unauthorized or invalid Partner Token](/documentation/troubleshooting/invalid-partner-token-401).
  </Step>

  <Step title="Fix 403 Entitlement or Claims">
    For `content_rewrite_not_enabled`, ask [Suki Technical Support](mailto:support@suki.ai) to enable content rewrite for the partner or user. For claim or partner-detail failures, follow [403 Permission Denied](/documentation/troubleshooting/permission-denied-403).
  </Step>

  <Step title="Handle 500 and Downstream Errors">
    Retry quietly. Store `request_id` from the message or response body before you open a ticket.
  </Step>
</Steps>

<Note>
  On Rewrite content, inactive providers return **400** (`provider_user_inactive`). On many other Ambient and Dictation endpoints the same condition can return **412**.
</Note>

## Next steps

<Icon icon="file-lines" iconType="solid" /> **[Ambient and Dictation error messages](/api-reference/error-messages#content-rewrite)** - Full rewrite error ids

<Icon icon="file-lines" iconType="solid" /> **[Rewrite Dictation content](/documentation/how-to/dictation/rewrite-dictation-content)** - Request shape, write-back, and failure UX

<Icon icon="file-lines" iconType="solid" /> **[Rewrite content](/api-reference/content/rewrite)** - Endpoint fields and examples

<Icon icon="file-lines" iconType="solid" /> **[403 Permission Denied](/documentation/troubleshooting/permission-denied-403)** - Authz and partner claim failures

<Icon icon="file-lines" iconType="solid" /> **[401 Unauthorized or invalid Partner Token](/documentation/troubleshooting/invalid-partner-token-401)** - Token and provider registration failures


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.