Skip to main content
Create a repository document
curl --request POST \
  --url https://app.simpledocs.com/api/v1/repository_documents \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form file='@example-file' \
  --form 'url=<string>' \
  --form 'metadata={"department":"Legal","category":"Vendor"}'
import requests

url = "https://app.simpledocs.com/api/v1/repository_documents"

files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
    "url": "<string>",
    "metadata": "{\"department\":\"Legal\",\"category\":\"Vendor\"}"
}
headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, data=payload, files=files, headers=headers)

print(response.text)
const form = new FormData();
form.append('file', '<string>');
form.append('url', '<string>');
form.append('metadata', '{"department":"Legal","category":"Vendor"}');

const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

options.body = form;

fetch('https://app.simpledocs.com/api/v1/repository_documents', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{ "success": true, "message": "Document created successfully", "data": { "id": "0dbhXg", "name": "Employment Agreement.pdf", "created_at": "2023-11-07T05:31:56Z" } }

Authorizations

Authorization
string
header
required

Obtain a Bearer token via the Create access token endpoint using the OAuth2 client credentials flow.

Body

multipart/form-data
file
file

The document file to upload. Required if url is not provided.

url
string<uri>

A public HTTPS URL to fetch the document from. Required if file is not provided. Internal and private network addresses are blocked.

metadata
string

A JSON string with arbitrary metadata to attach to the document.

Example:

"{\"department\":\"Legal\",\"category\":\"Vendor\"}"

Response

Document created successfully.

success
boolean
Example:

true

message
string
Example:

"Document created successfully"

data
object