graphlife Docs graphlife.app

Integration API

Service accounts

A key minted by a person is held to that person's role and groups on every call, and stops working when they leave the organisation. A service account is a member of the organisation that is not a person. It has a role and groups, nobody can sign in as it, and a key minted for it keeps working whoever comes and goes.

Route Body and response
POST/v1/orgs/{org}/service-accounts {"name", "role"?: "admin" | "member" | "guest", "groups"?: [ids], "writeGroup"?} answers {"serviceAccountId", "name", "role"}. role defaults to member
GET/v1/orgs/{org}/service-accounts {"serviceAccounts": [{"serviceAccountId", "name", "role", "groups", "disabledAt", "createdAt", "keys"}]}. keys is a count
PATCH/v1/orgs/{org}/service-accounts/{id} {"name"?, "disabled"?: true | false}. While disabled, every key it holds answers 404
DELETE/v1/orgs/{org}/service-accounts/{id} deletes it, its keys and their webhooks

All four need the session of an organisation owner or admin.

  • An admin gives a service account only groups they hold themselves (409 scope_exceeds_yours).
  • Only an owner creates, changes or deletes a service account whose role is admin.
  • Its role, groups and write group are changed with the member route, PATCH /v1/orgs/{org}/members/{serviceAccountId}. It can never be made an owner.
  • It is not listed among the organisation's members, and DELETE /v1/orgs/{org}/members/{id} on it answers 409 service_account.

A key for a service account#

Add "serviceAccount": "<id>" to the body of POST /v1/graphs/{id}/keys:

{"label": "ETL",
 "serviceAccount": "<service account id>",
 "scope": {"groups": ["<group id>"],
           "tools": ["stats", "search", "node", "list_nodes", "list_edges",
                     "changes"],
           "level": "full"}}
  • The scope must name groups (400 groups_required). Each must be held by the service account, and by the admin minting it when the minter is not an owner (409 scope_exceeds_yours).
  • Its tools must be ones the account's role allows (400 scope_too_wide).
  • From then on the key is bounded by the service account's role and groups on every call. Demote the account and the key loses what the role no longer allows; disable it and the key answers 404.

In the key list such a key shows principal.type: "service", and mintedBy names the person who created it and so held its secret. That is how an owner finds the keys to rotate after that person has left.

Text and entities a service account's key writes are nobody's first person: a "Me" in them is dropped, with the relations at it.