Sonatype · Capability

Sonatype Lifecycle Public REST API — User Tokens

Sonatype Lifecycle Public REST API — User Tokens. 8 operations. Lead operation: User Tokens. Self-contained Naftiko capability covering one Sonatype business surface.

Run with Naftiko SonatypeUser Tokens

What You Can Do

GET
Getusertokensbycreatedbetweenandrealmid — Use this method to retrieve user tokens created within a date range, in the supported IQ Server realms.
/v1/api/v2/usertokens
DELETE
Deletecurrentusertoken — Use this method to delete an existing user token for the currently logged in user.
/v1/api/v2/usertokens/currentuser
POST
Createusertoken — Use this method to generate a user token for the currently logged in user.
/v1/api/v2/usertokens/currentuser
GET
Getcurrentusertokencreatetime — Use this method to retrieve the creation time of the user token for the currently logged in user.
/v1/api/v2/usertokens/currentuser/createtime
GET
Getusertokenexistsforcurrentuser — Use this method to check if a user token has been issued to the logged in user.
/v1/api/v2/usertokens/currentuser/hastoken
DELETE
Purgeusertokens — Use this method to delete all existing LDAP user tokens.
/v1/api/v2/usertokens/purge
DELETE
Deleteusertokenbyusercode — Use this method to delete an existing user token by specifying the userCode.
/v1/api/v2/usertokens/usercode/{usercode}
GET
Getusertokenbyusernameandrealmid — Use this method to retrieve a user token by specifying a username and realmId.
/v1/api/v2/usertokens/{username}

MCP Tools

use-this-method-retrieve-user

Use this method to retrieve user tokens created within a date range, in the supported IQ Server realms.

read-only idempotent
use-this-method-delete-existing

Use this method to delete an existing user token for the currently logged in user.

idempotent
use-this-method-generate-user

Use this method to generate a user token for the currently logged in user.

use-this-method-retrieve-creation

Use this method to retrieve the creation time of the user token for the currently logged in user.

read-only idempotent
use-this-method-check-if

Use this method to check if a user token has been issued to the logged in user.

read-only idempotent
use-this-method-delete-all

Use this method to delete all existing LDAP user tokens.

idempotent
use-this-method-delete-existing-2

Use this method to delete an existing user token by specifying the userCode.

idempotent
use-this-method-retrieve-user-2

Use this method to retrieve a user token by specifying a username and realmId.

read-only idempotent

Capability Spec

lifecycle-user-tokens.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: Sonatype Lifecycle Public REST API — User Tokens
  description: 'Sonatype Lifecycle Public REST API — User Tokens. 8 operations. Lead operation: User Tokens. Self-contained
    Naftiko capability covering one Sonatype business surface.'
  tags:
  - Sonatype
  - User Tokens
  created: '2026-05-19'
  modified: '2026-05-19'
binds:
- namespace: env
  keys:
    SONATYPE_API_KEY: SONATYPE_API_KEY
capability:
  consumes:
  - type: http
    namespace: lifecycle-user-tokens
    baseUri: ''
    description: Sonatype Lifecycle Public REST API — User Tokens business capability. Self-contained, no shared references.
    resources:
    - name: api-v2-userTokens
      path: /api/v2/userTokens
      operations:
      - name: getusertokensbycreatedbetweenandrealmid
        method: GET
        description: Use this method to retrieve user tokens created within a date range, in the supported IQ Server realms.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: createdAfter
          in: query
          type: string
          description: Enter the start date for the date range in `yyyy-mm-dd` format.
        - name: createdBefore
          in: query
          type: string
          description: Enter the end date for the date range in `yyyy-mm-dd` format.
        - name: realm
          in: query
          type: string
          description: Enter the `realmId`. Possible values are `Internal`, `SAML` , `OAUTH2`, and `Crowd`.
    - name: api-v2-userTokens-currentUser
      path: /api/v2/userTokens/currentUser
      operations:
      - name: deletecurrentusertoken
        method: DELETE
        description: Use this method to delete an existing user token for the currently logged in user.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
      - name: createusertoken
        method: POST
        description: Use this method to generate a user token for the currently logged in user.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: api-v2-userTokens-currentUser-createTime
      path: /api/v2/userTokens/currentUser/createTime
      operations:
      - name: getcurrentusertokencreatetime
        method: GET
        description: Use this method to retrieve the creation time of the user token for the currently logged in user.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: api-v2-userTokens-currentUser-hasToken
      path: /api/v2/userTokens/currentUser/hasToken
      operations:
      - name: getusertokenexistsforcurrentuser
        method: GET
        description: Use this method to check if a user token has been issued to the logged in user.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: api-v2-userTokens-purge
      path: /api/v2/userTokens/purge
      operations:
      - name: purgeusertokens
        method: DELETE
        description: Use this method to delete all existing LDAP user tokens.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: api-v2-userTokens-userCode-userCode
      path: /api/v2/userTokens/userCode/{userCode}
      operations:
      - name: deleteusertokenbyusercode
        method: DELETE
        description: Use this method to delete an existing user token by specifying the userCode.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: userCode
          in: path
          type: string
          description: Enter the `userCode` to be deleted.
          required: true
    - name: api-v2-userTokens-username
      path: /api/v2/userTokens/{username}
      operations:
      - name: getusertokenbyusernameandrealmid
        method: GET
        description: Use this method to retrieve a user token by specifying a username and realmId.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: username
          in: path
          type: string
          description: Enter the username.
          required: true
        - name: realm
          in: query
          type: string
          description: Enter the realmId. Possible values are `Internal`, `SAML` , `OAUTH2` , and `Crowd`.
    authentication:
      type: bearer
      token: '{{env.SONATYPE_API_KEY}}'
  exposes:
  - type: rest
    namespace: lifecycle-user-tokens-rest
    port: 8080
    description: REST adapter for Sonatype Lifecycle Public REST API — User Tokens. One Spectral-compliant resource per consumed
      operation, prefixed with /v1.
    resources:
    - path: /v1/api/v2/usertokens
      name: api-v2-usertokens
      description: REST surface for api-v2-userTokens.
      operations:
      - method: GET
        name: getusertokensbycreatedbetweenandrealmid
        description: Use this method to retrieve user tokens created within a date range, in the supported IQ Server realms.
        call: lifecycle-user-tokens.getusertokensbycreatedbetweenandrealmid
        with:
          createdAfter: rest.createdAfter
          createdBefore: rest.createdBefore
          realm: rest.realm
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/api/v2/usertokens/currentuser
      name: api-v2-usertokens-currentuser
      description: REST surface for api-v2-userTokens-currentUser.
      operations:
      - method: DELETE
        name: deletecurrentusertoken
        description: Use this method to delete an existing user token for the currently logged in user.
        call: lifecycle-user-tokens.deletecurrentusertoken
        outputParameters:
        - type: object
          mapping: $.
      - method: POST
        name: createusertoken
        description: Use this method to generate a user token for the currently logged in user.
        call: lifecycle-user-tokens.createusertoken
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/api/v2/usertokens/currentuser/createtime
      name: api-v2-usertokens-currentuser-createtime
      description: REST surface for api-v2-userTokens-currentUser-createTime.
      operations:
      - method: GET
        name: getcurrentusertokencreatetime
        description: Use this method to retrieve the creation time of the user token for the currently logged in user.
        call: lifecycle-user-tokens.getcurrentusertokencreatetime
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/api/v2/usertokens/currentuser/hastoken
      name: api-v2-usertokens-currentuser-hastoken
      description: REST surface for api-v2-userTokens-currentUser-hasToken.
      operations:
      - method: GET
        name: getusertokenexistsforcurrentuser
        description: Use this method to check if a user token has been issued to the logged in user.
        call: lifecycle-user-tokens.getusertokenexistsforcurrentuser
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/api/v2/usertokens/purge
      name: api-v2-usertokens-purge
      description: REST surface for api-v2-userTokens-purge.
      operations:
      - method: DELETE
        name: purgeusertokens
        description: Use this method to delete all existing LDAP user tokens.
        call: lifecycle-user-tokens.purgeusertokens
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/api/v2/usertokens/usercode/{usercode}
      name: api-v2-usertokens-usercode-usercode
      description: REST surface for api-v2-userTokens-userCode-userCode.
      operations:
      - method: DELETE
        name: deleteusertokenbyusercode
        description: Use this method to delete an existing user token by specifying the userCode.
        call: lifecycle-user-tokens.deleteusertokenbyusercode
        with:
          userCode: rest.userCode
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/api/v2/usertokens/{username}
      name: api-v2-usertokens-username
      description: REST surface for api-v2-userTokens-username.
      operations:
      - method: GET
        name: getusertokenbyusernameandrealmid
        description: Use this method to retrieve a user token by specifying a username and realmId.
        call: lifecycle-user-tokens.getusertokenbyusernameandrealmid
        with:
          username: rest.username
          realm: rest.realm
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    namespace: lifecycle-user-tokens-mcp
    port: 9090
    transport: http
    description: MCP adapter for Sonatype Lifecycle Public REST API — User Tokens. One tool per consumed operation, routed
      inline through this capability's consumes block.
    tools:
    - name: use-this-method-retrieve-user
      description: Use this method to retrieve user tokens created within a date range, in the supported IQ Server realms.
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: lifecycle-user-tokens.getusertokensbycreatedbetweenandrealmid
      with:
        createdAfter: tools.createdAfter
        createdBefore: tools.createdBefore
        realm: tools.realm
      outputParameters:
      - type: object
        mapping: $.
    - name: use-this-method-delete-existing
      description: Use this method to delete an existing user token for the currently logged in user.
      hints:
        readOnly: false
        destructive: true
        idempotent: true
      call: lifecycle-user-tokens.deletecurrentusertoken
      outputParameters:
      - type: object
        mapping: $.
    - name: use-this-method-generate-user
      description: Use this method to generate a user token for the currently logged in user.
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: lifecycle-user-tokens.createusertoken
      outputParameters:
      - type: object
        mapping: $.
    - name: use-this-method-retrieve-creation
      description: Use this method to retrieve the creation time of the user token for the currently logged in user.
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: lifecycle-user-tokens.getcurrentusertokencreatetime
      outputParameters:
      - type: object
        mapping: $.
    - name: use-this-method-check-if
      description: Use this method to check if a user token has been issued to the logged in user.
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: lifecycle-user-tokens.getusertokenexistsforcurrentuser
      outputParameters:
      - type: object
        mapping: $.
    - name: use-this-method-delete-all
      description: Use this method to delete all existing LDAP user tokens.
      hints:
        readOnly: false
        destructive: true
        idempotent: true
      call: lifecycle-user-tokens.purgeusertokens
      outputParameters:
      - type: object
        mapping: $.
    - name: use-this-method-delete-existing-2
      description: Use this method to delete an existing user token by specifying the userCode.
      hints:
        readOnly: false
        destructive: true
        idempotent: true
      call: lifecycle-user-tokens.deleteusertokenbyusercode
      with:
        userCode: tools.userCode
      outputParameters:
      - type: object
        mapping: $.
    - name: use-this-method-retrieve-user-2
      description: Use this method to retrieve a user token by specifying a username and realmId.
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: lifecycle-user-tokens.getusertokenbyusernameandrealmid
      with:
        username: tools.username
        realm: tools.realm
      outputParameters:
      - type: object
        mapping: $.