githubEdit

usersMembers

Manage organization members via API

Organization members have access to apps, resources, and settings within an organization. Use this API to programmatically manage team access.

List Members

GET https://api.spice.ai/v1/members

Returns a list of members in the authenticated organization.

Required scope: members:read

Response

{
  "members": [
    {
      "user_id": 1,
      "username": "alice",
      "roles": ["owner"],
      "is_owner": true,
      "created_at": "2024-01-01T00:00:00.000Z"
    },
    {
      "user_id": 2,
      "username": "bob",
      "roles": ["member"],
      "is_owner": false,
      "created_at": "2024-01-15T10:00:00.000Z"
    }
  ]
}

Response Fields:

Field
Type
Description

user_id

integer

User identifier

username

string

GitHub username

roles

string[]

Roles assigned to the member

is_owner

boolean

Whether the user is the organization owner

created_at

string

ISO 8601 timestamp when member was added

Example

Python:

Add Member

POST https://api.spice.ai/v1/members

Adds a new member to the organization with specified roles.

Required scope: members:write

Request Body

Request Fields:

Field
Type
Required
Description

username

string

Yes

GitHub username of the user to add

roles

string[]

No

Roles to assign (default: ["member"])

Response

Examples

Add a member with default role:

Add a member with custom roles:

Python:

Node.js:

Remove Member

DELETE https://api.spice.ai/v1/members/{memberId}

Removes a member from the organization (soft delete). Member access is revoked immediately.

Required scope: members:delete

Path Parameters

Parameter
Type
Description

memberId

integer

The user ID of the member to remove

Response

Member removed successfully. No response body.

Example

circle-exclamation

Member Roles

Members can have one or more roles:

Role
Description

owner

Organization owner (cannot be removed, full access)

member

Standard member access to apps and resources

billing

Can manage billing and subscription

admin

Administrative access (planned)

circle-info

Currently, all members have full access to organization resources. Fine-grained role-based access control is planned for future releases.

Prerequisites

Users must sign in to Spice.ai at least once before they can be added to an organization. If you try to add a user who hasn't signed in, you'll receive a 404 Not Found error.

User onboarding flow:

  1. User signs in to spice.aiarrow-up-right with GitHub

  2. User's account is created

  3. Organization admin adds user via API or portal

Bulk Operations

Add multiple members:

List all members with details:

Best Practices

Access Management

  1. Least Privilege - Assign minimal necessary roles to members

  2. Regular Audits - Periodically review member list and remove inactive users

  3. Onboarding - Ensure new team members sign in before adding them

  4. Offboarding - Remove members immediately when they leave the team

Automation

Organization Structure

For teams with complex access requirements:

  • Use separate organizations for different teams or projects

  • Create service accounts for automation (using PATs)

  • Document member roles and responsibilities

Limitations

  • Members can only be added if they have a Spice.ai account (must sign in first)

  • Organization owner cannot be removed or changed via API

  • Role-based access control is currently limited (all members have full access)

  • Personal organizations (matching username) cannot add/remove members

Troubleshooting

User Not Found (404)

The user doesn't have a Spice.ai account yet:

  1. Ask the user to sign in to spice.aiarrow-up-right with GitHub

  2. Verify the username is correct (case-sensitive)

  3. Try adding the member again after they sign in

User Already a Member (409)

The user is already in the organization:

  • To update roles, remove and re-add the member (planned: PATCH endpoint)

  • Use GET /v1/members to list current members

Cannot Remove Owner (403)

The organization owner cannot be removed:

  • Transfer ownership through the portal first (if needed)

  • Or create a new organization with a different owner

Terraform

Use the spiceai_member resource to manage members. See Terraform Provider for full documentation.

See also:

Last updated

Was this helpful?