---
title: "Set document URL"
method: POST
path: "/api/v1/set_document_url"
---

# Set document URL

`POST /api/v1/set_document_url`

## Request

- Base URL: `https://offprint.io`
- URL: `https://offprint.io/api/v1/set_document_url`
- Auth: HTTP bearer

Change a document's address: a new readable slug, with or without the random suffix. The old URL keeps redirecting, and the stable /d/ link never changes. Owner only, and only on plans with custom URLs (on Free, a document keeps the URL it was published at).

## Request body

- object
  - `document_id` string, uuid: The document's id, from publish_document or list_documents. Pass this or slug.
  - `slug` string: The document's current slug, to identify it.
  - `new_slug` string, required: The new readable stem for the address. A random suffix is appended unless clean_url is set.
  - `clean_url` boolean: Use new_slug exactly, with no random suffix.

## Response `200`

Success.

- object
  - `url` string, required: Absolute URL of the document's page.
  - `stable_url` string, required: Permanent /d/ link that survives renames and moves.
  - `slug` string, required

## Other responses

- `400`: Invalid arguments.
- `401`: Missing, expired or revoked API key.
- `403`: The key's scope, restriction or role does not allow this.
- `404`: Not found, or outside the key's restriction.
- `409`: The document changed since expected_revision.
- `429`: A plan limit or daily quota was reached.

---

[API](https://skmtc.dev/offprint/apis/offprint-api.md) · [All operations](https://skmtc.dev/offprint/apis/offprint-api/llms.txt) · [OpenAPI document](https://skmtc.dev/offprint/apis/offprint-api/revisions/d50a825280d2?raw)
