Last updated Mar 30, 2023

Suspend user access

This tutorial will help you to:

  • Suspend user access to products listed in Atlassian Administration.
  • Make product licenses available for active users.
  • Maintain respective users in Groups for easy restoration.

Before you begin

To complete this tutorial, you need the following:

API token ≠ API key:

  • This tutorial uses both API token and API key.
  • API token is used with Basic authentication.
  • API key is used as a Bearer token.

Steps to suspend user access

Illustration showing the steps to suspend a user's product access

Step 1: Get accountId

AccountId is a required path parameter to suspend user access.

1. Get API token

An API token is needed to get the accountId in the next step. Use an API token to authenticate your script.

Atlassian account API Tokens screen

To create an API token:

  1. Go to your Atlassian account to create an API token.
  2. Select Create API token at the top of the screen.
  3. Name the token.
  4. Copy and securely store the token - you will not be able to see it again.

2. Get accountId

To get the accountId:

  1. Use the Jira User Search API with the API token and basic authentication to get the accountId: GET /rest/api/3/users/search

    1
    2
    curl --request GET \ 
    --url 'https://your-domain.atlassian.net/rest/api/3/users/search' \ 
    --user 'email@example.com:<api_token>' \ 
    --header 'Accept: application/json'
    
  2. Search the results by email address or name to find the correct accountId.

Learn more about the Jira API.

If you don’t have Jira, export a .csv of the user list. Learn how to export users from a site.

Step 2: Suspend user access

1. Get API Key and Organization ID

The Suspend user access script uses an API key as a Bearer access token. It also uses the Organization ID field as a path parameter.

Screen to copy the API Key and Organization ID

To create an API key and get the Organization ID:

  1. Go to Atlassian Administration. Select your organization if you have more than one.
  2. Select Settings > API keys.
  3. Select Create API key in the top right.
  4. Enter a name that you’ll remember to identify the API key.
  5. By default, the key expires one week from today. If you’d like to change the expiration date, pick a new date under Expires on. You’re unable to select a date longer than a year from the date of creation.
  6. Select Create to save the API key.
  7. Copy the values for your Organization ID and API key. You'll need those to use the API key. Make sure you store these values in a safe place, as we won't show them to you again.
  8. Select Done. The key will appear in your list of API keys.

Learn more about the API keys.

2. Suspend user access

Use the accountId, API key and Organization ID from the previous steps to suspend user access: POST /admin/v1/orgs/{orgId}/directory/users/{accountId}/suspend-access

1
2
curl -vv --request POST \
--url 'https://api.atlassian.com/admin/v1/orgs/{orgId}/directory/users/{accountId}/suspend-access' \
--header 'Authorization: Bearer <api_key>' \
--header 'Accept: application/json'

Make your first request and get started with the Suspend user access API and get more information on error codes.

Rate this page: