Help Center/ AI DataLake/ API Reference/ Ray APIs/ RayJob Management/ Creating an Interactive Session
Updated on 2026-11-06 GMT+08:00

Creating an Interactive Session

Function

This API is used to create an interactive session. This API is synchronous and is used for interactive tools such as Notebook to connect to a Ray cluster. In federation user authentication scenarios, the secret name corresponding to the federation user identity is returned.

Calling Method

For details, see Calling APIs.

URI

POST /v2/workspaces/{workspace_id}/ray-sessions

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

workspace_id

Yes

String

Definition: Workspace ID. For details about how to obtain the workspace ID, see Obtaining a Workspace ID.

Constraints: N/A

Range: 1 to 36 characters. Only letters, digits, and hyphens (-) are allowed.

Default Value: N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

No

String

Definition: User token. It is obtained by calling the Obtaining an IAM User Token API.

Constraints: N/A

Range: Up to 65,534 characters.

Default Value: N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Definition: Session name.

Constraints: N/A

Range: 1 to 47 characters. Only letters, digits, hyphens (-), periods (.), and spaces are allowed.

Default Value: N/A

description

No

String

Definition: Description.

Constraints: N/A

Range: 0 to 1,024 characters.

Default Value: N/A

endpoint_name

Yes

String

Definition: Endpoint name.

Constraints: Complies with RFC 1035. Must start with a letter and end with a letter or digit.

Range: 1 to 63 characters. A combination of lowercase letters, digits, and hyphens (-).

Default Value: N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

session_id

String

Definition: Session ID.

Range: 1 to 36 characters. Only letters, digits, and hyphens (-) are allowed.

secret_name

String

Definition: pod-agency secret name, used for mounting federation identity credentials. An empty string is returned if the scenario does not involve AI Hub federation authentication.

Range: Up to 256 characters. Returns an empty string if left empty.

ray_grpc_server_port

String

Definition: Ray cluster gRPC connection port.

Range: Up to 5 characters. Returns an empty string if left empty.

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution description.

Range: 0 to 4,096 characters.

Status code: 401

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution description.

Range: 0 to 4,096 characters.

Status code: 403

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution description.

Range: 0 to 4,096 characters.

Status code: 404

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution description.

Range: 0 to 4,096 characters.

Status code: 408

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution description.

Range: 0 to 4,096 characters.

Status code: 500

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution description.

Range: 0 to 4,096 characters.

Example Requests

Create an interactive session.

POST https://{endpoint}/v2/workspaces/{workspace_id}/ray-sessions

{
  "name" : "my-session",
  "description" : "Interactive session example",
  "endpoint_name" : "ray"
}

Example Responses

Status code: 200

{
  "session_id" : "ac8111bf-3601-4905-8ddd-b41d3e636a4e",
  "secret_name" : "pod_agency_myAgency_001234_20260717120000",
  "ray_grpc_server_port" : "10001"
}

Status code: 400

{
  "error_code" : "common.01000001",
  "error_msg" : "failed to read http request, please check your input, code: 400, reason: Type mismatch., cause: TypeMismatchException",
  "solution_msg" : "Check whether the request parameters comply with the API definition and try again."
}

Status code: 401

{
  "error_code" : "APIG.1002",
  "error_msg" : "Incorrect token or token resolution failed",
  "solution_msg" : "Please check if auth token is included in the request header."
}

Status code: 403

{
  "error_code" : "APIG.1003",
  "error_msg" : "X-Auth-Token is invalid in the request",
  "solution_msg" : "Check whether the token in the request is valid and try again."
}

Status code: 404

{
  "error_code" : "common.01000001",
  "error_msg" : "response status exception, code: 404",
  "solution_msg" : "Please try to use correct info."
}

Status code: 408

{
  "error_code" : "common.00000408",
  "error_msg" : "timeout exception occurred",
  "solution_msg" : "The backend request timed out — check service health and network connectivity, then retry."
}

Status code: 500

{
  "error_code" : "common.00000500",
  "error_msg" : "internal error",
  "solution_msg" : "Contact operations for analysis."
}

Status Codes

Status Code

Description

200

Response body for creating an interactive session.

400

Invalid request.

401

Unauthorized.

403

Request denied.

404

The requested resource could not be found.

408

Request timeout.

500

Internal server error.