Skip to content
Suomi

Create a finding draft for the project's inspectors to publish or reject

POST
/v1/projects/{projectId}/finding-drafts
Code sample: Shell / cURL
curl --request POST \
--url https://api.whatsbuilt.fi/v1/projects/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/finding-drafts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "title": "example", "description": "example", "priority": "example", "labels": [ "example" ], "element_global_ids": [ "example" ], "storey_global_id": "example", "point": { "x": 1, "y": 1, "z": 1 }, "source_ref": "example", "photo_keys": [ "example" ] }'

A project holds at most 500 pending drafts; above that the answer is 409 DRAFT_LIMIT. A repeat with the same Idempotency-Key and body returns the first draft with 200.

projectId
required
string format: uuid
idempotency-key
string
/^[\x21-\x7e]{1,255}$/

A repeat with the same key and body returns the first answer instead of writing again. Keys are per integration and project.

Media typeapplication/json
object
title
required
string
>= 1 characters <= 500 characters
description
string | null
<= 20000 characters
priority
string | null
<= 255 characters
labels
Array<string>
<= 100 items
element_global_ids

GlobalIds of live elements in the project; the published finding selects them

Array<string>
<= 100 items
storey_global_id

The storey a point is on, when no element fits (spec 054 §3.8)

string | null
>= 1 characters <= 64 characters
point

Metres in the model’s coordinates, z at the storey’s floor; each within ±10000000 m

One of:
object
x
required
number format: double
> -10000000 < 10000000
y
required
number format: double
> -10000000 < 10000000
z
required
number format: double
> -10000000 < 10000000
source_ref

Your own id for the draft, shown to the inspector

string | null
>= 1 characters <= 128 characters
photo_keys

Up to 10 keys from uploadDraftPhoto, each uploaded before the draft is created

Array<string>
<= 10 items

Example generated

{
"title": "example",
"description": "example",
"priority": "example",
"labels": [
"example"
],
"element_global_ids": [
"example"
],
"storey_global_id": "example",
"point": {
"x": 1,
"y": 1,
"z": 1
},
"source_ref": "example",
"photo_keys": [
"example"
]
}

The draft an earlier call with the same Idempotency-Key created

Media typeapplication/json

A draft as /v1 answers it; for the document only.

object
id
required
string format: uuid
project_id
required
string format: uuid
title
required
string
description
required
string | null
priority
required
string | null
labels
required
Array<string>
element_global_ids
required
Array<string>
storey_global_id
required
string | null
point
required
One of:

Metres in the model’s coordinates, z at the storey’s floor

object
x
required
number format: double
y
required
number format: double
z
required
number format: double
source_ref
required
string | null
status
required
string
Allowed values: pending published rejected
created_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}$/
created_by_name
required
string | null
created_via
required
string | null
via_client_id
required
string | null
created_at
required
string
decided_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}$/
decided_by_name
required
string | null
decided_at
required
string | null
topic_guid
required
string | null format: uuid
photo_keys
required

The photos the draft carries; each becomes a photo of the published finding

Array<string>

Example

{
"status": "pending"
}

The draft

Media typeapplication/json

A draft as /v1 answers it; for the document only.

object
id
required
string format: uuid
project_id
required
string format: uuid
title
required
string
description
required
string | null
priority
required
string | null
labels
required
Array<string>
element_global_ids
required
Array<string>
storey_global_id
required
string | null
point
required
One of:

Metres in the model’s coordinates, z at the storey’s floor

object
x
required
number format: double
y
required
number format: double
z
required
number format: double
source_ref
required
string | null
status
required
string
Allowed values: pending published rejected
created_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}$/
created_by_name
required
string | null
created_via
required
string | null
via_client_id
required
string | null
created_at
required
string
decided_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}$/
decided_by_name
required
string | null
decided_at
required
string | null
topic_guid
required
string | null format: uuid
photo_keys
required

The photos the draft carries; each becomes a photo of the published finding

Array<string>

Example

{
"status": "pending"
}

Invalid body, parameters or Idempotency-Key

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, or PUBLIC_API_DISABLED when an admin of the integration’s organisation, or on a per-project route of the project’s owning organisation, has turned the API off

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 project, event or element

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"
}

DRAFT_LIMIT

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"
}