SaaS Quickstart
This guide walks you through obtaining a token using Authorization Code authentication and conversing with an agent via SSE.
Introduction
Here are the quickest steps to use the SaaS API. You can start conversing with an agent in just four steps.
This quickstart targets Web applications (Confidential Clients that can keep a Client Secret on the server side). For SPAs / mobile apps (Public Clients), the PKCE flow is required, so this quickstart cannot be used as-is. See the Authentication Guide for details.
- API option subscription is activated
- Ability to log in to Console (developer role or higher)
- A Web application type client has been created in Console (Console Guide)
- You have obtained the following information:
Client ID- The ID of the created applicationClient Secret- The application secretRedirect URI- The redirect URL registered in Console
Step 1: Verify Authentication Information
Verify the following information on the app detail screen in Console.
Example
Client ID: your-app-001
Client Secret: (hidden)
Redirect URI: http://localhost:3000/callback
Step 2: Obtain Authorization Code
Access the authorization endpoint in your browser, log in, and obtain an authorization code.
Construct Authorization URL
Open the following URL in your browser. Replace client_id, redirect_uri, and state with your own values.
https://auth.fd.agenticstar.tm.softbank.jp/federation/auth/v1/authorize?response_type=code&client_id=<your-client-id>&redirect_uri=<your-redirect-uri>&state=<random-state-value>
Parameters
response_type: Fixed ascodeclient_id: Client ID verified in Step 1redirect_uri: Redirect URI registered in Console (URL-encoded)state: Random string for CSRF protection (strongly recommended)
Login and Authorization
- A login screen appears in the browser. Log in with your usual account.
- If the application has the consent screen enabled, it is displayed on first use or when scopes are added. Review the content and grant permission.
Receive Authorization Code
After authorization, the browser redirects to redirect_uri. The code parameter in the URL is the authorization code.
http://localhost:3000/callback?code=AUTH_CODE_VALUE&state=<random-state-value>
- If
stateis specified, always verify that the value in the response matches the value from your request (CSRF protection) - The authorization code has a short expiration, so exchange it for a token immediately in the next step
Step 3: Obtain Token
Exchange the authorization code for an access token. Execute the following request from your server.
Request Example
1curl -X POST https://auth.fd.agenticstar.tm.softbank.jp/federation/auth/v1/token \2-H "Content-Type: application/x-www-form-urlencoded" \3-d "grant_type=authorization_code" \4-d "code=<auth-code>" \5-d "redirect_uri=<your-redirect-uri>" \6-d "client_id=<your-client-id>" \7-d "client_secret=<your-client-secret>"Parameters
grant_type: Fixed asauthorization_codecode: Authorization code obtained in Step 2redirect_uri: Same Redirect URI as Step 2client_id: Client ID verified in Step 1client_secret: Client Secret verified in Step 1
Response Example
{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"id_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_expires_in": 86400,
"scope": "openid chat:exec"
}
The token is valid for the number of seconds specified in expires_in. After expiration, you can refresh the token using refresh_token. See the Authentication Guide for details.
Step 4: 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
1curl -X POST https://api.fd.agenticstar.tm.softbank.jp/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 "messages": [8 {9 "role": "user",10 "content": "Hello"11 }12 ]13}'Parameters
<access_token>: Access token obtained in Step 3stream: true: Enable SSE streamingmessages: 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.
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.
Application creation, scope settings, and authentication information
Authentication flow details and token refresh
Compare and choose SSE, MCP, and A2A
SSE connection lifecycle, event handling, reconnection, error handling