Member Management APIMember Management API Reference

Member Management API Reference

Every call in the Member Management API - add and remove Access Groups, check groups, list and look up Members, change roles and groups, deactivate, and bulk calls - with fields, responses, limits and errors.

Manage Members From Your Own Tools

The Member Management API lets your checkout, CRM or automation tool manage the Members of one App with an API key from that App. It has eleven calls: add to and remove from Access Groups, check a person's groups, list and look up Members, change a role or groups, deactivate a Member, and three bulk calls for up to 100 people at a time.

For a step-by-step setup of automatic adds and removals, see Adding and Removing Members Automatically. To create a key, see API Keys.

Send a Request

Send every request to this base URL, followed by the call's path:

https://app.thoughtflow.ai

Every request needs two headers. Replace YOUR_API_KEY with your key, keeping the word Bearer and the space after it:

Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

In paths shown with {email}, put the person's email address in its place, as in /api/v1/access/members/avery.lane@example.com.

Responses

A successful response is JSON with the result under data:

{
  "data": { "revoked": true, "user_id": "0d6f5c1e-0000-4000-8000-000000000000" }
}

A failed request answers with an HTTP error status and an error holding a code and a message:

{
  "error": {
    "code": "user_not_found",
    "message": "No user with that email exists in this App"
  }
}

See Errors for every code.

Things to Know

  • Access changes take effect right away.
  • Sending the same add or remove twice is safe. Nothing doubles up.
  • role on an add applies only to people who are new to your App. It never changes the role of someone already in it. Use Change Role for that.
  • An unrecognized role is an error, not ignored. Send member or editor.
  • Group changes take add and remove lists, never a replacement list, so a mistyped list can't strip someone's access.
  • You can add groups to an App Admin like anyone else, but the API never changes an App Admin's role, deactivates one, or adds back a removed one.
  • Nothing is ever deleted. A deactivated Member can be added back.
  • Your App can't receive webhooks. Your other tool calls this API; there's no address in ThoughtFlow for it to post to.

Rate Limits

LimitAmount
Requests300 a minute for each API key. A bulk call counts as one request.
Invitation emails1,000 an hour for each API key.
People in a bulk call100.
Access Groups in one add or group change25.

Over a request or invitation limit, the response is 429 with a Retry-After header and retry_after_seconds in the error. Wait that many seconds, then send the request again.

Retry-After: 30

Add to Access Group

POST /api/v1/access/grant

Adds a person to one or more Access Groups. If they aren't in your App yet, they're added as a Member and, unless you say otherwise, sent an invitation email.

FieldDescription
emailRequired. The person's email.
access_group_id or access_group_nameOne group, by ID (recommended) or by name. Send one of the two, not both. Names match without regard to capitals.
access_group_ids or access_group_namesSeveral groups, by ID or by name, 25 at most. Use these instead of the single-group fields, not with them.
nameOptional. Used only when the person has no name yet. It never changes a name that's already set.
send_invitationOptional, true or false. Left out, people who need an invitation get one. false adds them with no email. A person already active in your App never gets another invitation.
roleOptional, member or editor, member by default. Applies only to people new to your App.
external_user_idOptional. Your own ID for the person.

Copy a group's ID from Group ID on the Access Groups page, or from the Snippet Generator. See Access Groups.

curl -X POST https://app.thoughtflow.ai/api/v1/access/grant \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "avery.lane@example.com",
    "name": "Avery Lane",
    "access_group_id": "7b1c9a52-0000-4000-8000-000000000000"
  }'

status is new for someone new to ThoughtFlow, existing for someone already in your App, and existing_added_to_workspace for someone with a ThoughtFlow account who wasn't active in your App, including a former Member added back. active_groups lists every group the person is in now, by name.

With the list form, the response also gives the person's role and a result for each group: added, or already_member if they were in it already.

curl -X POST https://app.thoughtflow.ai/api/v1/access/grant \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "avery.lane@example.com",
    "access_group_ids": [
      "7b1c9a52-0000-4000-8000-000000000000",
      "3e8f2d10-0000-4000-8000-000000000000"
    ],
    "send_invitation": false
  }'

Adding someone back. If the person was deactivated, or their access had ended, this call restores them with the role they had before and clears any old end date. Their old groups aren't restored, so name every group they should have. No email is sent, except an invitation to someone who never accepted their first one. A removed App Admin can't be added back this way.

Remove from Access Group

POST /api/v1/access/revoke

Removes a person from one Access Group. To remove several at once, use Change Groups.

FieldDescription
emailRequired. The person's email.
access_group_id or access_group_nameOne group, by ID (recommended) or by name. Send one of the two, not both.
curl -X POST https://app.thoughtflow.ai/api/v1/access/revoke \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "avery.lane@example.com",
    "access_group_id": "7b1c9a52-0000-4000-8000-000000000000"
  }'

The answer is the same if the person wasn't in the group. Removing a group doesn't remove the person from your App: they keep your Open tools and whatever their other groups give them. A person who isn't in your App, or is deactivated, gets 404 user_not_found.

Check Groups

GET /api/v1/access/users/{email}/groups

Lists the Access Groups a person is in now, with when each was granted and when it ends, if it does.

curl https://app.thoughtflow.ai/api/v1/access/users/avery.lane@example.com/groups \
  -H "Authorization: Bearer YOUR_API_KEY"

List Members

GET /api/v1/access/members

Lists the people in your App, a page at a time.

Query valueDescription
statusOptional. active (the default), expired or deactivated.
limitOptional. A whole number from 1 to 200, 100 by default.
cursorOptional. The next_cursor from the previous page, to get the next one. next_cursor is null on the last page.
curl "https://app.thoughtflow.ai/api/v1/access/members?status=active&limit=50" \
  -H "Authorization: Bearer YOUR_API_KEY"

Each entry gives the person's role (member, editor or admin), status (active, expired or deactivated), ends_at and current groups.

Look Up Member

GET /api/v1/access/members/{email}

Finds one person by email. The answer holds a member entry in the same shape as List Members.

curl https://app.thoughtflow.ai/api/v1/access/members/avery.lane@example.com \
  -H "Authorization: Bearer YOUR_API_KEY"

Change Role

PATCH /api/v1/access/members/{email}

Switches a person between Member and Editor.

FieldDescription
roleRequired. member or editor.
curl -X PATCH https://app.thoughtflow.ai/api/v1/access/members/avery.lane@example.com \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "role": "editor" }'

changed is false when the person already had that role. A deactivated Member must be added back first. An App Admin's role can't be changed here. What each role can do is covered in Team Roles.

Change Groups

PATCH /api/v1/access/members/{email}/groups

Adds and removes Access Groups in one call.

FieldDescription
add_access_group_ids, add_access_group_namesLists of groups to add, by ID or by name.
remove_access_group_ids, remove_access_group_namesLists of groups to remove, by ID or by name.

Send at least one list, with 25 groups at most in all. A group can't be both added and removed. A deactivated Member must be added back first.

curl -X PATCH https://app.thoughtflow.ai/api/v1/access/members/avery.lane@example.com/groups \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "add_access_group_ids": ["7b1c9a52-0000-4000-8000-000000000000"],
    "remove_access_group_ids": ["3e8f2d10-0000-4000-8000-000000000000"]
  }'

Each group's result is added, already_member, removed or not_member.

Deactivate Member

DELETE /api/v1/access/members/{email}

Ends a person's access to your App and removes them from all of their Access Groups. It never deletes them. Adding them back later restores their access, but not their groups.

curl -X DELETE https://app.thoughtflow.ai/api/v1/access/members/avery.lane@example.com \
  -H "Authorization: Bearer YOUR_API_KEY"

deactivated is false when the person was already deactivated. An App Admin can't be deactivated here.

Bulk Calls

The three bulk calls take a members list of up to 100 people and answer with one result for each person, in the order you sent them. Each result has the email as you sent it and ok: true with the person's data, or false with an error. succeeded and failed count them. One person failing doesn't stop the others.

Some mistakes refuse the whole request, and nothing changes for anyone:

  • The body isn't a JSON object, or members is missing or empty.
  • More than 100 people.
  • The same email more than once.
  • An Access Group that doesn't exist, in Bulk Add or Bulk Update.

If a result's error code is not_processed, the request ran out of time before it reached that person, and nothing changed for them. Send them again.

Bulk Add

POST /api/v1/access/bulk/add

Each person in members takes the same fields as Add to Access Group.

curl -X POST https://app.thoughtflow.ai/api/v1/access/bulk/add \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "members": [
      { "email": "avery.lane@example.com", "access_group_id": "7b1c9a52-0000-4000-8000-000000000000" },
      { "email": "jordan.reyes@example.com", "access_group_ids": ["7b1c9a52-0000-4000-8000-000000000000", "3e8f2d10-0000-4000-8000-000000000000"] }
    ]
  }'

Bulk Update

POST /api/v1/access/bulk/update

Each person in members takes an email, plus role, the four group lists from Change Groups, or both. Send at least one. Each successful result holds the person's member entry, changed when you sent a role, and groups when you sent a group list.

curl -X POST https://app.thoughtflow.ai/api/v1/access/bulk/update \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "members": [
      { "email": "avery.lane@example.com", "add_access_group_ids": ["3e8f2d10-0000-4000-8000-000000000000"] },
      { "email": "casey.morgan@example.com", "role": "editor" }
    ]
  }'

Bulk Deactivate

POST /api/v1/access/bulk/deactivate

Each person in members takes only an email. Each successful result holds the same data as Deactivate Member.

curl -X POST https://app.thoughtflow.ai/api/v1/access/bulk/deactivate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "members": [ { "email": "avery.lane@example.com" }, { "email": "jordan.reyes@example.com" } ] }'

Errors

StatusCodeMeaning
400bad_requestThe body is missing a field or isn't valid. The message names the field, such as "email is required."
401unauthorizedThe API key is missing, wrong or revoked. The message is "Invalid or missing API key".
403insufficient_permissionThe API key doesn't have the Access Management permission.
403admin_role_refusedThe call tried to change or deactivate an App Admin, or sent role as admin.
404access_group_not_foundNo Access Group with that ID or name exists in this App. A list call names the groups it couldn't find.
404user_not_foundNo person with that email is in this App.
409admin_restore_refusedThe person is an App Admin whose access was removed, so an add can't restore it.
409member_deactivatedThe Member is deactivated. Add them back before changing their role or groups.
409membership_changedThe person's membership changed while the request ran. Send it again.
429request_limit_reachedThis key sent too many requests. Wait for the Retry-After seconds.
429invitation_limit_reachedThis key caused too many invitation emails. Nothing changed for that person. Wait for the Retry-After seconds.
429rate_limited"The email service is not accepting more invitations right now. Try again later."
500db_errorA read or write failed. Send the request again.
500invite_failedThe invitation email couldn't be sent.
500account_create_failedThe account couldn't be created. Try again.
500auth_lookup_failedThe account lookup failed. Try again.
200not_processedIn a bulk result only: the request ran out of time before this person. Nothing changed for them. Send them again.
Was this page helpful?