Sonatype User Tokens API

Use this REST API to manage user tokens.

GitHub OpenAPI
Pull this API's OpenAPI, operations, scores and pricing into your own code or AI agent with a free APIs.io key — sign in with GitHub, Google or LinkedIn. No form to fill in; signing in shares your email address with us (Privacy).

Operations 8

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

GET /api/v2/userTokens List user tokens created in a date range · Get user tokens by created between and realm id #
Ask an LLM
“Which user tokens were created between two dates?”
“Can I filter user tokens by the realm they were issued in?”
Tell an agent
List user tokens created between {createdAfter} and {createdBefore}.
Show user tokens in realm {realm} created between {createdAfter} and {createdBefore}.
DELETE /api/v2/userTokens/currentUser Delete the current user's token · Delete current user token #
Ask an LLM
“How do I revoke my own user token?”
“Can I delete the token I just generated?”
Tell an agent destructive · confirm first
Delete my current user token.
Revoke the personal token I created.
POST /api/v2/userTokens/currentUser Generate a user token for the current user · Create user token #
Ask an LLM
“How do I create a personal API token for myself?”
“Can I generate a new user token without admin permissions?”
Tell an agent
Create a user token for the current user.
Generate a new personal token for me.
GET /api/v2/userTokens/currentUser/createTime Get when my user token was created · Get current user token create time #
Ask an LLM
“When was my personal user token created?”
“What is the creation time of my current token?”
Tell an agent
Get the creation time of my current user token.
Tell me when my personal token was issued.
GET /api/v2/userTokens/currentUser/hasToken Check if I have a user token · Get user token exists for current user #
Ask an LLM
“Do I already have a user token?”
“Has a personal token been issued to me yet?”
Tell an agent
Check whether I have a user token.
Tell me if a personal token exists for my account.
DELETE /api/v2/userTokens/purge Delete all LDAP user tokens · Purge user tokens #
Ask an LLM
“How do I wipe every LDAP user token at once?”
“Can I purge all LDAP user tokens in one call?”
Tell an agent destructive · confirm first
Purge all LDAP user tokens.
Delete every user token issued to LDAP users.
DELETE /api/v2/userTokens/userCode/{userCode} Delete a user token by user code · Delete user token by user code #
Ask an LLM
“How do I delete a user token when I only have the user code?”
“Can I remove a user token by its user code?”
Tell an agent destructive · confirm first
Delete the user token with user code {userCode}.
Remove the token for user code {userCode}.
GET /api/v2/userTokens/{username} Get a user token by username and realm · Get user token by username and realm id #
Ask an LLM
“How do I look up a user token by username?”
“Can I fetch a user token for a user in a specific realm?”
Tell an agent
Get the user token for {username}.
Look up {username}'s token in realm {realm}.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/sonatype:sonatype-user-tokens-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

sonatype-user-tokens-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Sonatype User Tokens API
  version: '1.0'
  description: 'Operations tagged User Tokens across 2 of this provider''s published API definitions: sonatype-lifecycle-openapi.yml, sonatype-iq-openapi.yml. Each path carries the servers of the definition it was published in.'
security:
- BasicAuth: []
  BearerAuth: []
tags:
- description: Use this REST API to manage user tokens.
  name: User Tokens
paths:
  /api/v2/userTokens:
    get:
      description: 'Use this method to retrieve user tokens created within a date range, in the supported IQ Server realms.


        Permissions required: Edit System Configuration and Users.'
      operationId: getUserTokensByCreatedBetweenAndRealmId
      parameters:
      - description: Enter the start date for the date range in `yyyy-mm-dd` format.
        in: query
        name: createdAfter
        schema:
          type: string
      - description: Enter the end date for the date range in `yyyy-mm-dd` format.
        in: query
        name: createdBefore
        schema:
          type: string
      - description: Enter the `realmId`. Possible values are `Internal`, `SAML` , `OAUTH2`, and `Crowd`.
        in: query
        name: realm
        schema:
          default: Internal
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ApiUserTokenDTO'
                type: array
          description: The response contains a list of user tokens, each containing a `userCode`, `username` and the name of the IQ server `realm`.
      tags:
      - User Tokens
      summary: Get user tokens by created between and realm id
      x-summary-source: derived
  /api/v2/userTokens/currentUser:
    delete:
      description: 'Use this method to delete an existing user token for the currently logged in user.


        Permissions required: None'
      operationId: deleteCurrentUserToken
      responses:
        '204':
          description: User token deleted successfully.
      tags:
      - User Tokens
      summary: Delete current user token
      x-summary-source: derived
    post:
      description: 'Use this method to generate a user token for the currently logged in user.


        Permissions required: None'
      operationId: createUserToken
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiUserTokenDTO'
          description: The response contains the generated user token consisting of `userCode`, `username` `passCode`, and the IQ Server `realm`.
      tags:
      - User Tokens
      summary: Create user token
      x-summary-source: derived
  /api/v2/userTokens/currentUser/createTime:
    get:
      description: 'Use this method to retrieve the creation time of the user token for the currently logged in user.


        Permissions required: None'
      operationId: getCurrentUserTokenCreateTime
      responses:
        '200':
          content:
            application/json:
              schema:
                type: string
          description: The response contains the token creation time in ISO format.
        '404':
          description: User token does not exist for the current user.
      tags:
      - User Tokens
      summary: Get current user token create time
      x-summary-source: derived
  /api/v2/userTokens/currentUser/hasToken:
    get:
      description: 'Use this method to check if a user token has been issued to the logged in user.


        Permissions required: None'
      operationId: getUserTokenExistsForCurrentUser
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiUserTokenExistsDTO'
          description: The response contains a `userTokenExists` field.
      tags:
      - User Tokens
      summary: Get user token exists for current user
      x-summary-source: derived
  /api/v2/userTokens/purge:
    delete:
      description: 'Use this method to delete all existing LDAP user tokens.


        Permissions required: Edit System Configuration and Users'
      operationId: purgeUserTokens
      responses:
        '204':
          description: User tokens purged successfully.
      tags:
      - User Tokens
      summary: Purge user tokens
      x-summary-source: derived
  /api/v2/userTokens/userCode/{userCode}:
    delete:
      description: 'Use this method to delete an existing user token by specifying the userCode.


        Permissions required: Edit System Configuration and Users'
      operationId: deleteUserTokenByUserCode
      parameters:
      - description: Enter the `userCode` to be deleted.
        in: path
        name: userCode
        required: true
        schema:
          type: string
      responses:
        '204':
          description: User token deleted successfully.
      tags:
      - User Tokens
      summary: Delete user token by user code
      x-summary-source: derived
  /api/v2/userTokens/{username}:
    get:
      description: 'Use this method to retrieve a user token by specifying a username and realmId.


        Permissions required: Edit System Configuration and Users'
      operationId: getUserTokenByUsernameAndRealmId
      parameters:
      - description: Enter the username.
        in: path
        name: username
        required: true
        schema:
          type: string
      - description: Enter the realmId. Possible values are `Internal`, `SAML` , `OAUTH2` , and `Crowd`.
        in: query
        name: realm
        schema:
          default: Internal
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiUserTokenDTO'
          description: The response contains the `userCode`, `username` and the name of the IQ server `realm`.
      tags:
      - User Tokens
      summary: Get user token by username and realm id
      x-summary-source: derived
components:
  schemas:
    ApiUserTokenDTO:
      properties:
        createTime:
          type: string
        expirationDate:
          format: date-time
          type: string
        lastAccessTime:
          type: string
        passCode:
          type: string
        realm:
          type: string
        userCode:
          type: string
        username:
          type: string
      type: object
    ApiUserTokenExistsDTO:
      properties:
        userTokenExists:
          type: boolean
      type: object
    ApiUserTokenDTO_2:
      type: object
      properties:
        userCode:
          type: string
        passCode:
          type: string
        username:
          type: string
        realm:
          type: string
        createTime:
          type: string
          format: date-time
        lastAccessTime:
          type: string
          format: date-time
        expirationDate:
          type: string
          format: date-time
  securitySchemes:
    BasicAuth:
      scheme: basic
      type: http
    BearerAuth:
      bearerFormat: JWT
      scheme: bearer
      type: http
x-refined-from:
- sonatype-lifecycle-openapi.yml
- sonatype-iq-openapi.yml