Portfolio
Portfolio: an organization that looks after other organizations (a group, a family office, a franchisor, an outside firm), the companies that let it in, and its people placed in each.
| Operation | Summary | Scope | Idempotency-Key |
|---|---|---|---|
POST /v1/portfolio/codes |
Make a code a company connects with | admin |
|
GET /v1/portfolio/companies |
List the companies this organization looks after | admin |
|
DELETE /v1/portfolio/companies/{link_id} |
Stop looking after a company | admin |
|
PUT /v1/portfolio/companies/{link_id}/people/{user_id} |
Place a person in a company | admin |
|
DELETE /v1/portfolio/companies/{link_id}/people/{user_id} |
Take a person out of a company | admin |
|
GET /v1/portfolio/looked-after-by |
List who looks after this organization | admin |
|
POST /v1/portfolio/looked-after-by |
Let an organization look after this one | admin |
|
PATCH /v1/portfolio/looked-after-by/{link_id} |
Change what an organization's people may do here | admin |
|
DELETE /v1/portfolio/looked-after-by/{link_id} |
Stop an organization looking after this one | admin |
POST /v1/portfolio/codes
Make a code a company connects with
A one-time code to hand a company this organization is to look after: its administrator
enters it (POST /v1/portfolio/looked-after-by). Shown once; good for 14 days.
| Required scope | admin (admin implies every scope) |
| Idempotency-Key | not used |
| Operation id | create_code_v1_portfolio_codes_post |
Example request
curl -X POST "$ERP_URL/v1/portfolio/codes" \
-H "Authorization: Bearer $ERP_KEY"
Responses
| Status | Meaning | Body |
|---|---|---|
| 201 | Created | PortfolioCodeOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 409 | The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"code": "string",
"expires_at": "2026-09-21T09:30:00Z"
}
GET /v1/portfolio/companies
List the companies this organization looks after
The companies connected to this organization, the role each chose, and whom of this organization's people it placed in each.
| Required scope | admin (admin implies every scope) |
| Operation id | list_companies_v1_portfolio_companies_get |
Example request
curl "$ERP_URL/v1/portfolio/companies" \
-H "Authorization: Bearer $ERP_KEY"
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | array of PortfolioConnectionOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
[
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"organization": "string",
"role": "accountant",
"access_until": "2026-09-21T09:30:00Z",
"connected_at": "2026-09-21T09:30:00Z",
"people": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name": null,
"email": "string",
"status": "string",
"since": "2026-09-21T09:30:00Z"
}
]
}
]
DELETE /v1/portfolio/companies/{link_id}
Stop looking after a company
End the connection from this side: the company sees it ended, and everyone placed there is disabled there.
| Required scope | admin (admin implies every scope) |
| Idempotency-Key | not used |
| Operation id | end_company_v1_portfolio_companies__link_id__delete |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| path | link_id |
string (uuid) | yes | Id of the connection, as this organization's own list shows it. |
Example request
curl -X DELETE "$ERP_URL/v1/portfolio/companies/{link_id}" \
-H "Authorization: Bearer $ERP_KEY"
Responses
| Status | Meaning | Body |
|---|---|---|
| 204 | No content | |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 404 | The resource does not exist, or belongs to another organization (not_found). |
ErrorEnvelope |
| 409 | The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
PUT /v1/portfolio/companies/{link_id}/people/{user_id}
Place a person in a company
Give one of this organization's people (GET /v1/users) access to the company, with the
role and end of access the company chose. They sign in as always and switch to it. Placing
someone already placed changes nothing. Refused with 409 (portfolio_person_exists) when the
company has its own user record for that address.
| Required scope | admin (admin implies every scope) |
| Idempotency-Key | not used |
| Operation id | place_v1_portfolio_companies__link_id__people__user_id__put |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| path | link_id |
string (uuid) | yes | Id of the connection, as this organization's own list shows it. |
| path | user_id |
string (uuid) | yes | Id of the person in this organization (GET /v1/users). |
Example request
curl -X PUT "$ERP_URL/v1/portfolio/companies/{link_id}/people/{user_id}" \
-H "Authorization: Bearer $ERP_KEY"
Responses
| Status | Meaning | Body |
|---|---|---|
| 204 | No content | |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 404 | The resource does not exist, or belongs to another organization (not_found). |
ErrorEnvelope |
| 409 | The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
DELETE /v1/portfolio/companies/{link_id}/people/{user_id}
Take a person out of a company
Disable the person's user record in the company and end their sessions there. Disabling
a person in this organization (PATCH /v1/users/{user_id}) takes them out of every company.
| Required scope | admin (admin implies every scope) |
| Idempotency-Key | not used |
| Operation id | take_out_v1_portfolio_companies__link_id__people__user_id__delete |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| path | link_id |
string (uuid) | yes | Id of the connection, as this organization's own list shows it. |
| path | user_id |
string (uuid) | yes | Id of the person in this organization (GET /v1/users). |
Example request
curl -X DELETE "$ERP_URL/v1/portfolio/companies/{link_id}/people/{user_id}" \
-H "Authorization: Bearer $ERP_KEY"
Responses
| Status | Meaning | Body |
|---|---|---|
| 204 | No content | |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 404 | The resource does not exist, or belongs to another organization (not_found). |
ErrorEnvelope |
| 409 | The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
GET /v1/portfolio/looked-after-by
List who looks after this organization
The organizations that look after this one (a group, a family office, a franchisor, an outside firm), the role their people have here, when it ends, and who of them is placed here.
| Required scope | admin (admin implies every scope) |
| Operation id | list_looked_after_by_v1_portfolio_looked_after_by_get |
Example request
curl "$ERP_URL/v1/portfolio/looked-after-by" \
-H "Authorization: Bearer $ERP_KEY"
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | array of PortfolioConnectionOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
[
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"organization": "string",
"role": "accountant",
"access_until": "2026-09-21T09:30:00Z",
"connected_at": "2026-09-21T09:30:00Z",
"people": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name": null,
"email": "string",
"status": "string",
"since": "2026-09-21T09:30:00Z"
}
]
}
]
POST /v1/portfolio/looked-after-by
Let an organization look after this one
Connect with the code the other organization gave you (POST /v1/portfolio/codes there),
and choose what its people may do here (role, default accountant) and when their access
ends. Its people get in only once it places them, each with a user record of their own here
named after them and their organization. Refused with 422 (portfolio_code_invalid) for a
code that is wrong, used or older than 14 days, and with 409 when that organization already
looks after this one (portfolio_already_connected) or in a test copy
(portfolio_test_copy).
| Required scope | admin (admin implies every scope) |
| Idempotency-Key | not used |
| Operation id | connect_v1_portfolio_looked_after_by_post |
Request body
application/json (required): PortfolioConnectInput
| Field | Type | Required | Description |
|---|---|---|---|
code |
string | yes | The code the organization that is to look after this one gave you. (min length 10; max length 200) |
role |
"accountant" | "controller" | "viewer" |
What its people may do in this organization: viewer (reads), accountant (reads, drafts and posts) or controller (also approves, as the company's approval rules allow). (default "accountant") |
|
access_until |
string (date-time) or null | When their access ends, at most two years ahead; null for no end. |
Example request
curl -X POST "$ERP_URL/v1/portfolio/looked-after-by" \
-H "Authorization: Bearer $ERP_KEY" \
-H "Content-Type: application/json" \
-d '{
"code": "pf_5f0c3b1e9d2a4c6b8e7f1a2b3c4d5e6f_x2Vb9QmT4kLp8RzN3wYd1sHc"
}'
Responses
| Status | Meaning | Body |
|---|---|---|
| 201 | Created | PortfolioConnectionOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 409 | The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"organization": "string",
"role": "accountant",
"access_until": "2026-09-21T09:30:00Z",
"connected_at": "2026-09-21T09:30:00Z",
"people": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name": "string",
"email": "string",
"status": "string",
"since": "2026-09-21T09:30:00Z"
}
]
}
PATCH /v1/portfolio/looked-after-by/{link_id}
Change what an organization's people may do here
A new role or end of access for every person the organization placed here, at once.
| Required scope | admin (admin implies every scope) |
| Idempotency-Key | not used |
| Operation id | change_v1_portfolio_looked_after_by__link_id__patch |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| path | link_id |
string (uuid) | yes | Id of the connection, as this organization's own list shows it. |
Request body
application/json (required): PortfolioConnectionChange
| Field | Type | Required | Description |
|---|---|---|---|
role |
"accountant" | "controller" | "viewer" or null |
A new role for its people: viewer (reads), accountant (reads, drafts and posts) or controller (also approves, as the company's approval rules allow). |
|
access_until |
string (date-time) or null | A new end of their access, at most two years ahead; null removes the end. Left out: it stays. |
Example request
curl -X PATCH "$ERP_URL/v1/portfolio/looked-after-by/{link_id}" \
-H "Authorization: Bearer $ERP_KEY" \
-H "Content-Type: application/json" \
-d '{
"role": "viewer"
}'
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | PortfolioConnectionOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 404 | The resource does not exist, or belongs to another organization (not_found). |
ErrorEnvelope |
| 409 | The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"organization": "string",
"role": "accountant",
"access_until": "2026-09-21T09:30:00Z",
"connected_at": "2026-09-21T09:30:00Z",
"people": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name": "string",
"email": "string",
"status": "string",
"since": "2026-09-21T09:30:00Z"
}
]
}
DELETE /v1/portfolio/looked-after-by/{link_id}
Stop an organization looking after this one
End the connection: every person it placed here is disabled at once and their sessions end. Their past work stays in the audit trail under their names.
| Required scope | admin (admin implies every scope) |
| Idempotency-Key | not used |
| Operation id | disconnect_v1_portfolio_looked_after_by__link_id__delete |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| path | link_id |
string (uuid) | yes | Id of the connection, as this organization's own list shows it. |
Example request
curl -X DELETE "$ERP_URL/v1/portfolio/looked-after-by/{link_id}" \
-H "Authorization: Bearer $ERP_KEY"
Responses
| Status | Meaning | Body |
|---|---|---|
| 204 | No content | |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 404 | The resource does not exist, or belongs to another organization (not_found). |
ErrorEnvelope |
| 409 | The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Schemas
PlacedPersonOut
| Field | Type | Required | Description |
|---|---|---|---|
id |
string (uuid) | yes | The person's user id in the organization that looks after the company. |
name |
string or null | yes | Their name. |
email |
string | yes | Their sign-in address. |
status |
string | yes | Their user record in the company: invited (not signed in there yet), active or disabled. |
since |
string (date-time) | yes | When they were placed in the company. |
PortfolioCodeOut
| Field | Type | Required | Description |
|---|---|---|---|
code |
string | yes | The code to hand the company: its administrator enters it to connect. Shown once; good for 14 days and for one connection. |
expires_at |
string (date-time) | yes | When the code stops working. |
PortfolioConnectInput
| Field | Type | Required | Description |
|---|---|---|---|
code |
string | yes | The code the organization that is to look after this one gave you. (min length 10; max length 200) |
role |
"accountant" | "controller" | "viewer" |
What its people may do in this organization: viewer (reads), accountant (reads, drafts and posts) or controller (also approves, as the company's approval rules allow). (default "accountant") |
|
access_until |
string (date-time) or null | When their access ends, at most two years ahead; null for no end. |
PortfolioConnectionChange
| Field | Type | Required | Description |
|---|---|---|---|
role |
"accountant" | "controller" | "viewer" or null |
A new role for its people: viewer (reads), accountant (reads, drafts and posts) or controller (also approves, as the company's approval rules allow). |
|
access_until |
string (date-time) or null | A new end of their access, at most two years ahead; null removes the end. Left out: it stays. |
PortfolioConnectionOut
| Field | Type | Required | Description |
|---|---|---|---|
id |
string (uuid) | yes | Id (uuid) of the connection, as this organization sees it. |
organization |
string | yes | The name of the other organization. |
role |
"accountant" | "controller" | "viewer" |
yes | What the people placed in the company may do there. |
access_until |
string (date-time) or null | yes | When their access ends; null for no end. |
connected_at |
string (date-time) | yes | When the company connected. |
people |
array of PlacedPersonOut |
yes | The people of the organization that looks after placed in the company. |