PATCH /v1/document
Edit a document.
Request Body (possible options)
{
  "id": "MO0lJElX",
  "content": "hello world!",
  "settings": {
    "language": "plaintext",
    "expiration": null,
    "image_embed": false,
    "instant_delete": false,
    "public": false,
    "editors": ["username"]
  }
}ℹ️
All fields except id are optional.
⚠️
You must be authenticated and own or have edit access to the document to edit it.
⚠️
Editors do not have access to edit the editors list.
Example
Minimal Example:
fetch("https://api.impb.in/v1/document", {
  method: "PATCH",
  headers: {
    Authorization: "imperial_123456789",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    id: "MO0lJElX",
    content: "hello world!",
  }),
})
  .then((res) => res.json())
  .then(console.log)
  .catch((err) => console.error(err));Options:
fetch("https://api.impb.in/v1/document", {
  method: "PATCH",
  headers: {
    Authorization: "imperial_123456789",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    id: "MO0lJElX",
    content: "hello world edited!",
    settings: {
      language: "plaintext",
      expiration: null,
      image_embed: false,
      instant_delete: false,
      public: false,
      editors: ["username"],
    },
  }),
})
  .then((res) => res.json())
  .then(console.log)
  .catch((err) => console.error(err));Responses
200 OK
{
  "success": true,
  "data": {
    "id": "MO0lJElX",
    "content": "hello world edited!",
    "creator": null,
    "gist_url": null,
    "views": 0,
    "timestamps": {
      "creation": "2023-04-15T20:40:45.045Z",
      "expiration": "2023-04-22T20:40:45.045Z"
    },
    "links": {
      "formatted": "https://impb.in/MO0lJElX",
      "raw": "https://impb.in/r/MO0lJElX"
    },
    "settings": {
      "language": "plaintext",
      "image_embed": false,
      "instant_delete": false,
      "encrypted": false,
      "public": false,
      "editors": []
    }
  }
}400 Bad Request
{
  "success": false,
  "error": {
    "message": "Invalid request body",
    "errors"?: ZodErrors
  }
}401 Unauthorized
{
  "success": false,
  "error": {
    "message": "Unauthorized"
  }
}403 Forbidden
{
  "success": false,
  "error": {
    "message": "You are not allowed to edit this document"
  }
}404 Not Found
{
  "success": false,
  "error": {
    "message": "Document not found"
  }
}5xx Internal Server Error
{
  "success": false,
  "error": {
    "message": "Internal server error"
  }
}