Skip to content
Suomi

Invite a person to the organisation

POST
/v1/organisation/users
Code sample: Shell / cURL
curl --request POST \
--url https://api.whatsbuilt.fi/v1/organisation/users \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "email": "hello@example.com", "name": "example", "role": "admin" }'

The person gets an invitation e-mail and chooses their own password; the API never sets one. An address that already has a user answers 409. An integration’s address is refused. A repeat with the same Idempotency-Key and body returns the first person with 200; another body answers 422. Once it is deleted, the key answers 410 RESOURCE_DELETED and makes nothing.

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

The body of createUser.

object
email
required
string format: email
<= 255 characters
name
required
string
>= 1 characters <= 255 characters
role

viewer when absent.

string
default: viewer
Allowed values: admin inspector viewer

The person an earlier call with the same Idempotency-Key invited

Media typeapplication/json

Person: a person of the organisation.

object
id
required
string
/^[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}$/
email
required
string format: email
name
required
string | null
role
required

An account role.

string
Allowed values: admin inspector viewer
created_at
required
string

Example

{
"role": "admin"
}

Invited

Media typeapplication/json

CreatedPerson: the invited person.

object
id
required
string
/^[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}$/
email
required
string format: email
name
required
string | null
role
required

An account role.

string
Allowed values: admin inspector viewer
created_at
required
string
warning_details

The address is on a domain that signs in with SSO; the person is created anyway

Array<object>

One invitation warning.

object
code
required

The code of an invitation warning.

string
Allowed values: SSO_DOMAIN_OWN SSO_DOMAIN_OTHER
domain
required
string

Example

{
"role": "admin",
"warning_details": [
{
"code": "SSO_DOMAIN_OWN"
}
]
}

VALIDATION_ERROR; INVALID_EMAIL

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 principal is not an admin of its organisation; PUBLIC_API_DISABLED

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

Not found in the 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"
}

EMAIL_IN_USE

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

RESOURCE_DELETED: what this Idempotency-Key created has since been deleted; details.id names it

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