Skip to main content

Marketplace Quickstart

This guide walks you through obtaining a token using Client Credentials authentication and conversing with an agent via SSE.

Introduction

Here are the quickest steps to use the Marketplace API. You can start conversing with an agent in just three steps.

Prerequisites
  • Setup of the AGENTIC STAR environment purchased from Marketplace is complete
  • A service account has been created in the Admin panel
  • You have Base URL, Client ID, Client Secret, and Agent ID

Step 1: Verify Authentication Information

Gather the information you need to call the Chat API from the Admin panel. Note that these values are retrieved from different screens.

From the Service Account detail screen

  • Base URL — Base URL of your Marketplace deployment
  • Client ID — Client ID issued for the service account
  • Client Secret — Secret issued for the service account

From the Agent management screen

  • Agent ID — Identifier to pass as the agentId parameter in Chat API calls. Available on the detail page of the target agent under Agent Management → Agent Settings in the Admin panel (see Settings Guide — Agent Settings).

Authentication Information Example

Base URL: https://<your-domain>
Client ID: mp-service-001
Client Secret: (hidden)
Agent ID: agent-ai-bot

Step 2: Obtain Token

Use the Client Credentials flow to obtain an access token. Execute the following request from your server.

Request Example

Obtain access token
1curl -X POST https://<your-domain>/api/v1/auth/external-service-token \
2-H "Content-Type: application/json" \
3-d '{
4 "client_id": "<your-client-id>",
5 "client_secret": "<your-client-secret>"
6}'

Parameters

  • <your-domain>: Base URL verified in Step 1 (example: api.example.com)
  • <your-client-id>: Client ID verified in Step 1
  • <your-client-secret>: Secret verified in Step 1

Response Example

JSON
{
"success": true,
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 1800,
"scope": "openid"
}
Token Expiration

The token is valid for the number of seconds specified in expires_in. Obtain a new token before expiration. The Client Credentials flow does not issue refresh tokens, so after expiration, execute the same request again.

Step 3: Call Chat API

Use the obtained access token to call the Chat API via SSE (Server-Sent Events). You will receive real-time responses from the agent in stream format.

Request Example

Create chat completion
1curl -X POST https://<your-domain>/api/v1/chat/completions \
2-H "Authorization: Bearer <access_token>" \
3-H "Content-Type: application/json" \
4-d '{
5 "model": "AGENTIC STAR",
6 "stream": true,
7 "agentId": "<your-agent-id>",
8 "messages": [
9 {
10 "role": "user",
11 "content": "Hello"
12 }
13 ]
14}'

Parameters

  • <access_token>: Access token obtained in Step 2
  • <your-agent-id>: Agent ID verified in Step 1
  • stream: true: Enable SSE streaming
  • messages: Message from user. Multiple messages can be sent in array format

Response Example (SSE Stream)

data: {"choices":[{"delta":{"content":"Hello"}}]}

data: {"choices":[{"delta":{"content":", how can I"}}]}

data: {"choices":[{"delta":{"content":"help you?"}}]}

data: [DONE]

For readability, the snippet above only shows delta.content. Actual chunks include additional fields such as createdAt / model / choices[].index / finishReason. See the API Reference for the complete format.

About SSE Streaming

The response is in Server-Sent Events (SSE) format, sent in real-time in chunks. Each chunk is in the format data: JSON. The conversation completes with data: [DONE]. See Streaming Guide for details.

Next Steps

For more detailed information and implementation patterns, see the following documentation.