Document

Create document replacement credentials

  • Sandbox: available
  • Staging: available
  • Production: unknown
POST
/document/{id}

Replaces the file of an existing document. It updates the document's metadata and returns a signed upload form, as POST /document does.

Auth: bearer token. The document is read and updated with your token, so you need update access to the DocumentReference.

Behaviour

  • fileName and contentType are required and set on the document. isPublic is optional and works as in PATCH /document/{id}.
  • The current file is deleted before the upload form is returned. Until you upload the new file, the document has no file to download.
  • The document keeps its id, so existing references to it stay valid.
  • Upload with uploadOptions as described for POST /document. The form expires after 10 minutes.

Example

curl -X POST 'https://api.sandbox.ovok.com/document/c3499c27-2973-0a7f-807e-fb8676a92dcb' \  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \  -H 'Content-Type: application/json' \  -d '{ "fileName": "new-cat.png", "contentType": "image/png" }'

Authorization

bearer
headerAuthorizationBearer <JWT>

Path Parameters

id*string

The id of the DocumentReference resource

Formatuuid

Request Body

application/json
  1. body
fileName*string

The filename of the resource to be saved with.

Length1 <= length
contentType*string

The MIME type of the file.

isPublic?boolean

Whether the file should be public or private.

Response Body

The document with a new upload URL and form fields.

application/json
  1. response
id*string

The ID of the DocumentReference resource.

meta?

The metadata of the document.

author?

The author of the document.

fileName?string

The name of the document.

contentType?string

The content type of the document.

uploadOptions?

The upload options of the document.

publicToken?string

The public token of the document.

Example Request
curl -X POST 'https://api.sandbox.ovok.com/document/497f6eca-6276-4993-bfeb-53cbbbba6f08' \  -H 'Content-Type: application/json' \  -d '{  "fileName": "string",  "contentType": "string"}'
Example Response
{  "id": "string",  "meta": {    "lastUpdated": "string"  },  "author": {    "reference": "string",    "display": "string"  },  "fileName": "string",  "contentType": "string",  "uploadOptions": {    "url": "string",    "fields": {      "property1": "string",      "property2": "string"    }  },  "publicToken": "string"}

Download a document GET

Downloads the file of a document by answering with a redirect to a short-lived signed URL. Use it to show or download a file you have access to. **Auth:** bearer token. The DocumentReference is read with your token, so you need read access to it. ## Behaviour - The response is `307 Temporary Redirect`. The `Location` header holds the file URL. Follow the redirect to get the file. - For files Ovok stored, the signed URL is valid for one hour. Images (`image/jpeg`, `image/jpg`, `image/png`, `image/gif`, `image/webp`) are served inline; every other type is served as an attachment with the document's file name. - Pass `width` and `height` together to get a resized copy of an image. Both must be positive integers up to 16384. `fit` sets how the image fits the box (`cover` by default; also `contain`, `fill`, `inside`, `outside`). The resized copy is cached, so later requests for the same size are fast. Files that are not resizable images, and images larger than 40 MB, are returned unchanged. - If the image cannot be resized, the original file is returned. ## Example ```bash curl -L 'https://api.sandbox.ovok.com/document/c3499c27-2973-0a7f-807e-fb8676a92dcb?width=200&height=200&fit=cover' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \ -o cat.png ```

Update document metadata PATCH

Changes a document's file name, content type or public status, without uploading a new file. **Auth:** bearer token. The document is read and updated with your token, so you need update access to the DocumentReference. ## Behaviour - Every field is optional. Fields you leave out keep their value. - `contentType` must be one of the allowed types listed under `POST /document`. It changes both the DocumentReference and the stored file's content type. - `isPublic: true` gives a private document a public token. `isPublic: false` removes the public token, so existing public links stop working. Setting the status it already has changes nothing. - The response has the same shape as a search entry, without `uploadOptions`. ## Example ```bash curl -X PATCH 'https://api.sandbox.ovok.com/document/c3499c27-2973-0a7f-807e-fb8676a92dcb' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \ -H 'Content-Type: application/json' \ -d '{ "fileName": "updated-image.png", "isPublic": false }' ```