Auto-Assign Users to Teams via API

This article explains how to assign users to teams (roles) in SpotDraft using our Public APIs—ideal for automating access control when managing users from an external system with SCIM provisioning enabled.

 

🛠️ Why Use This?

Use this setup to:

  • Automatically assign users to the right team after they've been provisioned via SCIM.

  • Sync internal roles (e.g., Sales, CSM) with SpotDraft roles without manual intervention.

  • Update user access cleanly as team memberships change.

 

🚀 How It Works

This process is typically a one-time setup per user, triggered after they’re added to your identity provider (IdP) through SCIM. This API-based method enhances SCIM provisioning by enabling role assignments, complementing current SpotDraft SCIM provisioning capabilities.

 

📝 Prerequisites

  • ✅ Your SpotDraft account should have SCIM provisioning enabled.

  • ✅ Teams (roles) must be created in your SpotDraft instance.

  • ✅ The user should already exist in SpotDraft (via SCIM provisioning).

 

📘 Step-by-Step Guide

1. Get All Available Roles

Use this API to fetch role (team) IDs from SpotDraft:
➡️ GET /v2.1/public/auth/roles/list  Store this data in your iPaaS tool or an external DB. This is usually a one-time fetch.

 

2. Find the User’s SpotDraft ID

If you don’t already store SpotDraft user_id, fetch it using:
➡️ GET /v2.1/public/auth/users/list

 

4. Assign the User to a Role

Once you have the role_id and user_id, make a request to:
➡️ POST /v2.1/public/auth/roles/members/create

 

5. (Optional) Remove User from Previous Role

If the user is changing teams, remove them from the old team using:
➡️ DELETE /v2.1/public/auth/roles/members/delete

 

🔁 Trigger Options

  • Scheduled (e.g., a cron job that runs on a fixed time)

  • Event-based (e.g., when a user is assigned a role in your HRIS or IdP)

The trigger depends on your internal setup—your IT or engineering team can choose the best fit.

 

💬 FAQs

Q: Can I use this API flow if we don’t use SCIM or SAML?
A: Yes. While this flow is often used alongside SCIM, it also works independently. You just need the user's email or ID to assign them to a role via the API.

Q: Is there a default role assigned to users on creation?
A: No, SpotDraft does not assign users to any team by default. You need to explicitly assign roles using the API after user creation.

Q: What if the user isn’t on SpotDraft yet?
A: Ensure SCIM provisioning is working correctly. This API flow assumes the user already exists in SpotDraft.

Q: Do I need to run this for every user?
A: Typically, no—only when users are added or when their team changes (e.g., a role switch from Sales to CSM).

 

Need help implementing this? Contact Support or reach out to your SpotDraft CSM.

Related to

Was this article helpful?

0 out of 0 found this helpful