AI Toolkit REST endpoints

The Splunk platform REST API gives you access to the same information and functionality available to core system software and Splunk Web. You can access the Splunk REST endpoints through both the services endpoint and the servicesNS endpoint.

The services endpoint allows for access to a resource in a general manner, without assigning any context or a namespace. The servicesNS endpoint allows for the addition of some context and a namespace when accessing the resource.

Note: Accessing the AI Toolkit REST endpoints uses the servicesNS endpoint.

For more information see the Endpoints reference list in the Splunk Enterprise REST API Reference Manual and Access requirements and limitations for the Splunk Cloud Platform REST API in the Splunk Cloud Platform REST API Tutorials manual.

REST endpoints for ONNX models

ONNX is a model format specifically designed for facilitating the seamless exchange and sharing of models across different machine learning and deep learning frameworks such as sklearn, pytorch, and tensorflow.

The AI Toolkit provides the option to upload pre-trained ONNX models for inferencing in the AI Toolkit. You can train models in your preferred third-party environment, save the model in the .ONNX file format, upload the model file to the AI Toolkit, and then retrieve and inference that model in the AI Toolkit.

Note: The endpoints return the response in XML format. To get the response in a format like JSON, you can set the URL parameter of output_mode to json.

REST endpoint paths use the admin route or user route. If a particular user wants to access these endpoints, they must put their username in place of admin, even if the authentication password is the user's.

You can use the REST endpoints offered by the Splunk platform through the Splunk daemon port, which by default is port 8089. You can also use localhost.

For single cloud instances, you can use the virtual machine (VM) IP in place of localhost. In the event there is a Search Head Cluster you can use the main Deployment Server IP.

REST endpoints are available for the following ONNX model operations:

  • Uploading a new ONNX model or overwriting the existing, already uploaded model.
  • Listing existing, already uploaded ONNX models.
  • Deleting an existing, already uploaded ONNX model.

REST endpoints for Agent Launchpad

AI Toolkit version 6.3.0 adds 3 REST endpoints for managing Agent Launchpad agents. Use these endpoints to change settings across multiple agents, keep agent definitions in source control, or move agents between Splunk deployments.

Endpoint What it does
Agent bulk endpoint Creates, updates, or deletes up to 15 agents in one request.
Agent export endpoint Returns agent definitions as a bundle.
Agent import endpoint Creates or updates up to 15 agents from a bundle.

Common request requirements

These endpoints use the servicesNS endpoint. Replace <user> in each URL with the username for the account making the request.

  • Use the Splunk daemon port, which is 8089 by default. The examples use localhost.
  • Authenticate with basic authentication or a bearer token.
  • Send request bodies as JSON with the Content-Type: application/json header.
  • To receive JSON responses, set the URL parameter to output_mode=json.
  • Requests run as the calling user, with the same capabilities and agent access available in Agent Launchpad in Splunk Web.

Agent bulk endpoint

Use this endpoint to create, update, or delete up to 15 agents in one request. Operations run in the order submitted. If an operation fails, later operations still run, and successful changes remain.

The endpoint validates the entire request before processing any operations. If the request is malformed—for example, it contains more than 15 operations or an unknown field—the endpoint returns HTTP 400 and makes no changes.

Creating or deleting an agent starts a background setup job, so the request can return before setup finishes. For information about checking the job status, see Track agent create and delete.

Request type Endpoint URL
POST https://localhost:8089/servicesNS/<user>/Splunk_ML_Toolkit/mltk/agent_bulk

Payload

The request body contains an operations list with 1 to 15 operations. Each operation includes the following fields:

Field Description
id A unique ID for the operation within the request. The result uses the same ID.
action The operation to perform: create, update, or delete.
name The agent name. Each agent can appear in only 1 operation per request.
definition Required for create. Contains the new agent settings: system_prompt, task_prompt, description, llm, skills, mcps, knowledge_bases, structured_output, agent_timeout, and is_enabled.
changes Required for update. Contains the settings to change, using the same fields as definition. Unspecified fields keep their current values. LLM settings are merged; lists such as skills replace the existing list.

Created agents are owned by the calling user and start as private. The skills, MCP connections, knowledge bases, and LLM connection used by an agent must exist, and the calling user must be able to read them.

The following example updates the skills for one agent, creates another agent, and deletes a third:

JSON
{
  "operations": [
    {
      "id": "a1",
      "action": "update",
      "name": "serviceReview",
      "changes": {"skills": ["incident-summary"]}
    },
    {
      "id": "a2",
      "action": "create",
      "name": "incidentReview",
      "definition": {
        "system_prompt": "Review the supplied incident.",
        "llm": {"connection_name": "ops-llm"}
      }
    },
    {
      "id": "a3",
      "action": "delete",
      "name": "legacyReview"
    }
  ]
}

Response

The response includes an overall status, a count for each result state, and an items list with one result for each operation.

The following example shows 1 successful operation, 1 operation still running, and 1 failed operation:

JSON
{
  "status": "incomplete",
  "total": 3,
  "succeeded": 1,
  "failed": 1,
  "unconfirmed": 1,
  "not_processed": 0,
  "items": [
    {
      "id": "a1",
      "name": "serviceReview",
      "state": "succeeded",
      "http_status": 200
    },
    {
      "id": "a2",
      "name": "incidentReview",
      "state": "unconfirmed",
      "http_status": 202,
      "tracking_job_id": "1793793642.16193"
    },
    {
      "id": "a3",
      "name": "legacyReview",
      "state": "failed",
      "http_status": 403,
      "error_code": "FORBIDDEN",
      "error_message": "You cannot delete agent 'legacyReview'."
    }
  ]
}

The following table describes the possible operation states:

State Description
succeeded The operation is complete.
failed The operation was refused. See error_code and error_message for details.
unconfirmed The create or delete operation was accepted and is still running. If error_code is STILL_RUNNING, the request timed out while the operation was running. Check the agent before retrying.
not_processed The request timed out before the operation started. Send the operation again.

The overall status is success, partial_success, or failed. It is incomplete if any operation is unconfirmed or not_processed.

Error codes

The following table describes the error codes that can appear in error_code:

Error code When it appears
INVALID_REQUEST The request is malformed. For example, it contains an unknown field, an incorrect value type, or a repeated ID. No changes are made.
BATCH_LIMIT_EXCEEDED The request contains more than 15 operations. No changes are made.
INVALID_DEFINITION The agent settings are refused during processing, for example, because a value is not allowed.
FORBIDDEN The user cannot change or delete the agent.
NOT_FOUND The agent to update or delete does not exist.
NAME_CONFLICT An agent with the same name already exists.
MISSING_DEPENDENCY A skill, MCP connection, knowledge base, or LLM connection does not exist, or the user cannot read it.

Track agent create and delete

An agent create or delete operation sent to the bulk or import endpoint returns unconfirmed with a tracking_job_id while its setup job runs in the background. Setup usually takes 1 to 2 minutes.

To check the status of an agent, send a GET request until its state changes:

Request type Endpoint URL
GET https://localhost:8089/servicesNS/<user>/Splunk_ML_Toolkit/mltk/agents/<agent_name>

The following example checks the status of the incidentReview agent in the admin namespace:

CODE
https://localhost:8089/servicesNS/admin/Splunk_ML_Toolkit/mltk/agents/incidentReview?output_mode=json
  • A created agent is ready when its state is Available. While setup runs, its state is Creating.
  • A deleted agent is gone when the request returns HTTP 404 or the agent no longer appears in the agent list.

The tracking_job_id is a Splunk search job ID. You can also check the job at the following URL until Splunk removes the completed job:

CODE
https://localhost:8089/services/search/jobs/<tracking_job_id>

An operation with the unconfirmed state and an error_code of STILL_RUNNING has no tracking_job_id. Check the agent with the GET request above before retrying the operation.

Agent export endpoint

Use this endpoint to export agent definitions as a bundle. For example, you can keep the definitions in source control or move agents to another Splunk deployment. The bundle includes settings that are meaningful on another deployment. It does not include credentials, the owner, sharing settings, or runtime IDs.

Request type Endpoint URL
POST https://localhost:8089/servicesNS/<user>/Splunk_ML_Toolkit/mltk/agent_bundle/export

The following example exports agents in the admin namespace and requests a JSON response:

CODE
https://localhost:8089/servicesNS/admin/Splunk_ML_Toolkit/mltk/agent_bundle/export?output_mode=json

Payload

The request body is optional.

Field Description
agent_names Names of the agents to export, for example, ["serviceReview", "incidentReview"]. Omit this field to export every agent the user can read.
agent_type Type of agents to export. The default is aitk.

Response

The response contains the bundle. Save it as returned to import it later.
Field Description
format_version Bundle format version. The current value is 1.
agents Exported agent definitions, sorted by name.
dependencies The LLM connections, MCP connections, knowledge bases, and skills used by the agents. These dependencies must exist on the deployment where you import the bundle.
not_exported Requested agents that were not exported because they do not exist or the user cannot read them.

Agent import endpoint

Use this endpoint to create or update up to 15 agents from a bundle returned by the export endpoint. Agents are imported in bundle order, and each agent gets an individual result. Imported agents are owned by the calling user and start as private.

The endpoint validates the entire request before processing any agents. A malformed request, such as a bundle with more than 15 agents or an unsupported format_version, returns HTTP 400 and makes no changes.

The skills, MCP connections, knowledge bases, and LLM connections used by the agents must already exist on the deployment where you import the bundle, and the calling user must be able to read them. If connection names differ on that deployment, map them with connection_mappings.

An import failure does not roll back successful imports.

Request type Endpoint URL
POST https://localhost:8089/servicesNS/<user>/Splunk_ML_Toolkit/mltk/agent_bundle/import

The following example imports agents into the admin namespace and requests a JSON response:

CODE
https://localhost:8089/servicesNS/admin/Splunk_ML_Toolkit/mltk/agent_bundle/import?output_mode=json

Payload

The request body contains the following fields:

Field Description
definitions Required. The bundle returned by the export endpoint.
conflict_policy Specifies what to do if an agent with the same name already exists. fail (the default) refuses the import with NAME_CONFLICT. skip leaves the existing agent unchanged. update applies settings from the bundle while keeping the existing name, sharing, and runtime.
connection_mappings Optional. Maps connection or dependency names from the bundle to names on the target deployment. Supported keys are llm, mcp, knowledge_bases, and skills. Names not mapped remain unchanged.

The following example imports a bundle, skips agents that already exist, and maps the ops-llm connection to prod-llm:

PYTHON
{
  "definitions": {
    "format_version": 1,
    "agents": ["...agents from the export response..."]
  },
  "conflict_policy": "skip",
  "connection_mappings": {
    "llm": {
      "ops-llm": "prod-llm"
    }
  }
}

Replace the example placeholder with the agents array from the export response.

Response

The response has the same structure as the bulk endpoint response: an overall status, counts for each state, and an items list with one result for each agent.

  • An agent skipped because conflict_policy is skip has the skipped state.
  • An existing agent updated with conflict_policy set to update has the succeeded state when the change is saved.
  • A new agent has the unconfirmed state and a tracking_job_id until setup finishes. For information about checking the job status, see Track agent create and delete.

Authentication

Authentication is required to access the REST endpoints. You can authenticate in the following ways:

  • Basic authentication: User has basic authentication through their Splunk platform username and password
  • Bearer authentication: User has authentication through a token. A token for a user can be generated by the admin and can be used by the intended user through the REST API. To learn more see Create authentication tokens in the Securing Splunk Enterprise manual.

Upload endpoint

You can use the REST endpoints offered by the Splunk platform through the Splunk daemon port, which by default is port 8089. For the example provided the Splunk instance is running on localhost.

Make sure you have the capabilities for ONNX model uploads turned on for the user, or else the endpoint will throw an error.

Note: You can only upload ONNX models of less than 30 MB in size through this endpoint
Request type Endpoint URL Example
POST
CODE
https://localhost:8089/servicesNS/<user>/Splunk_ML_Toolkit/mltk/upload_model
If the admin wants to upload an ONNX model under their namespace the URL will be as follows:
CODE
https://localhost:8089/servicesNS/admin/Splunk_ML_Toolkit/mltk/upload_model

Payload

The upload endpoint is the content type of multipart/form-data. See the following table for more information:

field name Description
model_name The name you want to assign to this model. The model will appear on the Models tab of the AI Toolkit with the same name. Consequently, a lookup file is stored under the lookups section with the name format of __mlspl_{model_name}.onnx.mlmodel.
features The comma-separated list of feature names that will be fed to the ONNX model during inference. Make sure the comma-separated feature names match what shows in the UI. No validation check is performed.
targets The comma-separated list of target names that will be assigned as column names to the predictions made by the ONNX model. Make sure the comma-separated feature names match what shows in the UI. No validation check is performed.
file The model file with an extension of .ONNX. Model files without a .ONNX file extension cause an error.

List models endpoint

You can use the REST endpoints offered by the Splunk platform through the Splunk daemon port, which by default is port 8089. For the example provided the Splunk instance is running on localhost.

This endpoint gives a list of all ML models, including models that you have created through experiments and created manually. You can filter out the ONNX entries as those models have the extension of onnx.mlmodel.

Note: If you are logged in as a user and not as an admin, you only see your own ML models and not those created by others.
Request type Endpoint URL Example
GET
CODE
https://localhost:8089/servicesNS/<user>/Splunk_ML_Toolkit/mltk/list_models
If the admin wants to upload an ONNX model under their namespace the URL will be as follows:
CODE
https://localhost:8089/servicesNS/admin/Splunk_ML_Toolkit/mltk/list_models

Delete model endpoint

You can use the REST endpoints offered by the Splunk platform through the Splunk daemon port, which by default is port 8089. For the example provided the Splunk instance is running on localhost.

If the file is not owned by the user accessing it, the REST endpoint will throw an error. If the file you are trying to delete does not exist, the REST endpoint will throw an error.

Note: You can only delete the models that appear under the list_models endpoint.
Request type Endpoint URL Example
DELETE
CODE
https://localhost:8089/servicesNS/<user>/Splunk_ML_Toolkit/data/lookup-data-files/<model file with the .mlmodel extension suffix and mlspl_ prefix>
If the admin wants to delete an ONNX model with the name mlspl_testing.onnx.mlmodel under their namespace, the URL will be as follows:
CODE
https://localhost:8089/servicesNS/admin/Splunk_ML_Toolkit/data/lookup-data-files/mlspl_testing.onnx.mlmodel