Skip to content
Suomi

Record an uploaded reference document for the organisation's templates

POST
/v1/organisation/reference-documents
Code sample: Shell / cURL
curl --request POST \
--url https://api.whatsbuilt.fi/v1/organisation/reference-documents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "key": "example", "filename": "example" }'

Checks that the upload finished and is a PDF, and records it for the organisation; attach it with an organisation template write. Sending the same key again returns the same document with 200, so a repeat needs no Idempotency-Key.

Media typeapplication/json
object
key
required
string
>= 1 characters <= 512 characters
filename
required
string
>= 1 characters <= 255 characters /^[^\u0000-\u001f\u007f]+$/

Example generated

{
"key": "example",
"filename": "example"
}

The document this key was recorded as before

Media typeapplication/json

A reference document of the organisation’s templates.

object
id
required
string format: uuid
filename
required
string
content_type
required
string
byte_size
required
integer format: int64
uploaded_by
required
string | null
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/
uploaded_by_name
required
string | null
created_at
required
string
changed_at
required
string

Example generated

{
"id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"filename": "example",
"content_type": "example",
"byte_size": 1,
"uploaded_by": "example",
"uploaded_by_name": "example",
"created_at": "example",
"changed_at": "example"
}

The document

Media typeapplication/json

A reference document of the organisation’s templates.

object
id
required
string format: uuid
filename
required
string
content_type
required
string
byte_size
required
integer format: int64
uploaded_by
required
string | null
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/
uploaded_by_name
required
string | null
created_at
required
string
changed_at
required
string

Example generated

{
"id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"filename": "example",
"content_type": "example",
"byte_size": 1,
"uploaded_by": "example",
"uploaded_by_name": "example",
"created_at": "example",
"changed_at": "example"
}

DOCUMENT_UPLOAD_INCOMPLETE, DOCUMENT_CONTENT_MISMATCH, DOCUMENT_TOO_LARGE or a key of another organisation

Media typeapplication/json

The error body of every /v1 answer of 400 or more.

object
error
required

A sentence for people; it may change

string
code
required

Part of the contract

string
details

What the code names, where it names something

request_id
required

The X-Request-Id of the call

string

Example generated

{
"error": "example",
"code": "example",
"details": "example",
"request_id": "example"
}

Missing, malformed, expired or revoked token

Media typeapplication/json

The error body of every /v1 answer of 400 or more.

object
error
required

A sentence for people; it may change

string
code
required

Part of the contract

string
details

What the code names, where it names something

request_id
required

The X-Request-Id of the call

string

Example generated

{
"error": "example",
"code": "example",
"details": "example",
"request_id": "example"
}

INSUFFICIENT_SCOPE; INSUFFICIENT_ROLE when the integration is not an admin of its organisation

Media typeapplication/json

The error body of every /v1 answer of 400 or more.

object
error
required

A sentence for people; it may change

string
code
required

Part of the contract

string
details

What the code names, where it names something

request_id
required

The X-Request-Id of the call

string

Example generated

{
"error": "example",
"code": "example",
"details": "example",
"request_id": "example"
}

No such document

Media typeapplication/json

The error body of every /v1 answer of 400 or more.

object
error
required

A sentence for people; it may change

string
code
required

Part of the contract

string
details

What the code names, where it names something

request_id
required

The X-Request-Id of the call

string

Example generated

{
"error": "example",
"code": "example",
"details": "example",
"request_id": "example"
}

IDEMPOTENCY_KEY_REUSED: the key was used with another body

Media typeapplication/json

The error body of every /v1 answer of 400 or more.

object
error
required

A sentence for people; it may change

string
code
required

Part of the contract

string
details

What the code names, where it names something

request_id
required

The X-Request-Id of the call

string

Example generated

{
"error": "example",
"code": "example",
"details": "example",
"request_id": "example"
}

RATE_LIMITED; wait for Retry-After seconds

Media typeapplication/json

The error body of every /v1 answer of 400 or more.

object
error
required

A sentence for people; it may change

string
code
required

Part of the contract

string
details

What the code names, where it names something

request_id
required

The X-Request-Id of the call

string

Example generated

{
"error": "example",
"code": "example",
"details": "example",
"request_id": "example"
}