/v1/team/members/{userId}/accessSets one person’s role, their access (every company, or the selected ones) and the companies of a selected person. Send the revision you read from GET /v1/team; if someone changed the access since, the answer is 409 version_conflict.
Only an owner or an admin may change access. Only an owner gives owner or changes an owner. An admin with selected access gives only selected access, only to their own companies, and never admin. Nobody widens their own access. The last owner stays an owner (409 last_owner).
A selected person with no company reaches no company at all. Only a signed-in person can change access. An API key is refused with 401 session_required.
Path parameters
- userIdstring (uuid)Required
Request body
application/json, required
- rolestringRequiredOne of
owner,admin,developer,operator,auditor. - accessstringRequiredOne of
all,selected. - companiesarray of string (uuid)
- revisionintegerRequired
Response
A 200 answer carries these fields.
- userIdstring (uuid)Required
- emailstringRequired
- rolestringRequiredOne of
owner,admin,developer,operator,auditor. - accessstringRequired
Every company of the workspace, or only the listed ones. Selected with none reaches no company.
One ofall,selected. - companiesarray of objectRequired
The companies of a selected person and the role in each; empty for every-company access.
Show 2 child fields
- idstring (uuid)Required
- rolestringRequiredOne of
owner,admin,developer,operator,auditor.
- revisionintegerRequired
Send it back when changing this access.
Status codes
| Status | Meaning |
|---|---|
200 |
The person, as GET /v1/team lists them now. |
400 |
The body is not a role, an access and a revision (invalid_invitation), or a company is not one of this workspace (unknown_company). |
401 |
No usable credential was sent (invalid_credentials), or an API key was used (session_required). |
403 |
This person may not make this change (role_required). |
404 |
The person is not in this workspace (not_found). |
409 |
The access changed since it was read (version_conflict), or this is the last owner (last_owner). |
/v1/team/members/{userId}/accesscurl -X PUT https://api.certinvo.com/v1/team/members/$MEMBER_USER_ID/access \
-H "Authorization: Bearer $CERTINVO_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @body.jsonimport { readFile } from 'node:fs/promises'
const memberUserId = 'value'
const response = await fetch(`https://api.certinvo.com/v1/team/members/${memberUserId}/access`, {
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.CERTINVO_API_KEY}`,
'Content-Type': 'application/json',
},
body: await readFile('body.json'),
})
console.log(response.status, await response.json())import os
import requests
member_user_id = "value"
response = requests.put(
f"https://api.certinvo.com/v1/team/members/{member_user_id}/access",
headers={"Authorization": f"Bearer {os.environ['CERTINVO_API_KEY']}", "Content-Type": "application/json"},
data=open("body.json", "rb"),
)
print(response.status_code, response.text){
"userId": "3f0c2a5e-8d1b-4c7a-9e2f-6b5d4a3c2b1a",
"email": "string",
"role": "owner",
"access": "all",
"companies": [
{
"id": "3f0c2a5e-8d1b-4c7a-9e2f-6b5d4a3c2b1a",
"role": "owner"
}
],
"revision": 0
}