Request subscription and generate token

Subscribe POST https://{controlplane_path}/api/1/rest/public/api_subscription/subscribe
Get Subscriptions GET https://{controlplane_path}/api/1/rest/public/api_subscription
Generate Token POST https://{controlplane_path}/api/1/rest/public/api_subscription/token
Get Available Applications GET https://{controlplane_path}/api/1/rest/public/api_subscription/available_applications
Important: This API applies to APIM 3.0, not Classic APIM.

Subscribe to Services, retrieve subscriptions, generate access tokens, and find available applications. APIM 3.0 Developer Portal users use these APIs to manage their own Service subscriptions.

Prerequisites

  • A user account with access to the APIM 3.0 Developer Portal.
  • Subscribe and Generate Token: The caller must have access to the application and write access to the Service version.
  • Get Subscriptions: The caller must have access to the application (when querying by application_name) or write access to the Service version (when querying by service_slug and version_name).
Note: To get a response from these APIs for a given environment, the Allow access to APIM 3.0 Portal pages without login setting must be enabled on the API Management 3.0 settings page in Admin Manager. If disabled, all pages except the login page require users to log in.

Subscribe

POST https://{controlplane_path}/api/1/rest/public/api_subscription/subscribe

Subscribe an application to a Service version. If the Service version's Subscription rule has auto-approve enabled, the system approves the subscription immediately. Otherwise, the subscription remains pending until an admin approves it.

Example

This example uses Basic authentication. For a JWT example, refer to Authentication.

The following cURL examples use my-environment for the environment name.

curl -X 'POST' \
  'https://elastic.snaplogic.com/api/1/rest/public/api_subscription/subscribe' \
  -H 'Authorization: Basic {base64_encoded email:password}' \
  -H 'Content-Type: application/json' \
  -d '{
  "org_name": "my-environment",
  "application_name": "my-app",
  "version_name": "1.0",
  "service_slug": "bookstore-service"
}'

Request header

Use the application/json content type with basic authentication (email and password) or a JWT. For examples, refer to Authentication.

Request body

Key Type Description
org_name string Required. The name of the environment (Org).
application_name string Required. The name of the application.
version_name string Required. The Service version identifier.
service_slug string Required. The slug identifier for the Service.

Response


{
  "response_map": {
    "status": "ok",
    "message": "Subscribed to the Subscription Rule."
  },
  "http_status_code": 200
}

Get Subscriptions

GET https://{controlplane_path}/api/1/rest/public/api_subscription?org_name={org_name}

Retrieve subscriptions. Provide either application_name or both service_slug and version_name.

Example

This example uses Basic authentication. For a JWT example, refer to Authentication.

curl -X 'GET' \
  'https://elastic.snaplogic.com/api/1/rest/public/api_subscription?org_name=my-environment&application_name=my-app' \
  -H 'Authorization: Basic {base64_encoded email:password}'

Request header

Use the application/json content type with basic authentication (email and password) or a JWT. For examples, refer to Authentication.

Query parameters

Key Type Description
org_name string Required. The name of the environment (Org).
application_name string Required if service_slug and version_name are not provided. The name of the application. The caller must have access to the application.
version_name string Required with service_slug. The Service version identifier. The caller must have write access to the Service version.
service_slug string Required with version_name. The slug identifier for the Service.
status string Optional. Filter by subscription status, such as approved, pending, or revoked.
filter_by_user boolean Optional. If true, returns only subscriptions owned by the caller. Default: false.

Response

An array of subscription objects.


{
  "response_map": [
    {
      "application_id": "abc-123",
      "associated_snid": "...",
      "status": "approved",
      "type": "JWT",
      "created_by": "[email protected]",
      "subscription_expires_in": 1745678400000
    }
  ],
  "http_status_code": 200
}
Key Type Description
application_id string The unique ID of the application.
associated_snid string The snode ID of the associated Service version.
status string The subscription status, such as approved, pending, or revoked.
type string The subscription type: JWT or API_KEY.
created_by string The email address of the user who created the subscription.
subscription_expires_in number The subscription expiration time in milliseconds since epoch.

Generate Token

POST https://{controlplane_path}/api/1/rest/public/api_subscription/token

Generate an access token for a subscription. For API Key subscriptions, returns a bearer token. For JWT subscriptions, requires jwt_name and generates a JWT via the control plane.

You must approve the subscription before you can generate a token. For API Key tokens, you can retrieve the token only once; use refresh=true if you need a new one. For JWT tokens, jwt_name must be unique per subscription.

Example

This example uses Basic authentication. For a JWT example, refer to Authentication.

curl -X 'POST' \
  'https://elastic.snaplogic.com/api/1/rest/public/api_subscription/token' \
  -H 'Authorization: Basic {base64_encoded email:password}' \
  -H 'Content-Type: application/json' \
  -d '{
  "org_name": "my-environment",
  "application_name": "my-app",
  "version_name": "1.0",
  "service_slug": "bookstore-service",
  "jwt_name": "my-jwt-token",
  "jwt_expiration": "365",
  "jwt_period": "DAY"
}'

Request header

Use the application/json content type with basic authentication (email and password) or a JWT. For examples, refer to Authentication.

Request body

Key Type Description
org_name string Required. The name of the environment (Org).
application_name string Required. The name of the application.
version_name string Required. The Service version identifier.
service_slug string Required. The slug identifier for the Service.
refresh boolean Optional. If true, refreshes an existing token.
jwt_name string (Optional, required for JWT tokens) A unique name for the JWT.
jwt_expiration string Optional. The TTL duration for the JWT, such as "365".
jwt_period string Optional. The TTL period for the JWT, such as "DAY", "HOUR", or "MINUTE".

Response

For API Key subscriptions:


{
  "response_map": {
    "token": {
      "access_token": "eyJ...",
      "expires_in": 1745678400000,
      "token_type": "bearer"
    }
  },
  "http_status_code": 200
}

For JWT subscriptions, the response has the same structure but may include a warnings array (for example, if the TTL exceeds the subscription expiration).

Get Available Applications

GET https://{controlplane_path}/api/1/rest/public/api_subscription/available_applications?org_name={org_name}&version_name={version_name}&service_slug={service_slug}

List applications that the caller can use to subscribe to a given Service version. Returns only applications that are not already subscribed (or have a revoked subscription).

Example

This example uses Basic authentication. For a JWT example, refer to Authentication.

curl -X 'GET' \
  'https://elastic.snaplogic.com/api/1/rest/public/api_subscription/available_applications?org_name=my-environment&version_name=1.0&service_slug=bookstore-service' \
  -H 'Authorization: Basic {base64_encoded email:password}'

Request header

Use the application/json content type with basic authentication (email and password) or a JWT. For examples, refer to Authentication.

Query parameters

Key Type Description
org_name string Required. The name of the environment (Org).
version_name string Required. The Service version identifier.
service_slug string Required. The slug identifier for the Service.

Response

An array of application objects.


{
  "response_map": [
    {
      "application_name": "my-app",
      "_id": "abc-123",
      "created_by": "[email protected]"
    }
  ],
  "http_status_code": 200
}

Error handling

HTTP status codes Message Resolution
400 Either application_name or both service_slug and version_name are required. Provide the required query parameters for the Get Subscriptions endpoint.
400 A Unique JWT name is required for generating the token. Provide a unique jwt_name value when generating a JWT token.
401 Unauthorized Verify your credentials and APIM 3.0 Developer Portal authorization.
403 Application not Approved. Approve the subscription before generating a token.
403 Subscription has expired. This subscription has expired. Renew it before generating a token.
403 A subscription already exists with this Application. The application is already subscribed to this Service version.
404 Unable to find a subscription rule associated with the asset. Verify the environment name, Service slug, and version name are correct.
409 A JWT token is already generated using that name. Please refresh the token if you lost access to it. Use a different jwt_name or set refresh to true to regenerate the token.