Skip to main content
IBM Quantum Platform

Sessions


Create a session

Create a session

Body Parameters (application/json)

Name, TypeDescription
One of

HTTP Response Status Codes

Status codeDescription
200Ok
400Bad Request
401Unauthorized
500Internal error

Code samples

POST
/v1/sessions
curl -X POST \
  /api/v1/sessions \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Service-CRN: YOUR-SERVICE-CRN' \
  -H 'IBM-API-Version: 2025-05-01'

Responses

{
  "id": "example",
  "backend_name": "example",
  "started_at": "example",
  "activated_at": "example",
  "closed_at": "example",
  "last_job_started": "example",
  "last_job_completed": "example",
  "interactive_ttl": 1,
  "max_ttl": 1,
  "active_ttl": 1,
  "state": "open",
  "state_reason": "example",
  "accepting_jobs": true,
  "mode": "batch",
  "timestamps": [
    {
      "status": "open",
      "timestamp": "example"
    }
  ],
  "user_id": "example",
  "elapsed_time": 1.432
}

Get a session

Get a session

Path Parameters

Name, TypeDescription
id
Required
string

Job Session ID

HTTP Response Status Codes

Status codeDescription
200OK
401Unauthorized
404Not Found
500Internal error

Code samples

GET
/v1/sessions/{id}
curl -X GET \
  /api/v1/sessions/{id} \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Service-CRN: YOUR-SERVICE-CRN' \
  -H 'IBM-API-Version: 2025-05-01'

Responses

{
  "id": "example",
  "backend_name": "example",
  "started_at": "example",
  "activated_at": "example",
  "closed_at": "example",
  "last_job_started": "example",
  "last_job_completed": "example",
  "interactive_ttl": 1,
  "max_ttl": 1,
  "active_ttl": 1,
  "state": "open",
  "state_reason": "example",
  "accepting_jobs": true,
  "mode": "batch",
  "timestamps": [
    {
      "status": "open",
      "timestamp": "example"
    }
  ],
  "user_id": "example",
  "elapsed_time": 1.432
}

Update a session

Update a session

Path Parameters

Name, TypeDescription
id
Required
string

Job Session ID

Body Parameters (application/json)

Name, TypeDescription
accepting_jobs
Required
boolean

If true, the session is actively accepting new jobs to be queued. If false, jobs will be rejected on create and the session will be immediately closed when there are no more jobs to run in the session.

HTTP Response Status Codes

Status codeDescription
204Successfully updated session
401Unauthorized
404Not Found
500Internal error

Code samples

PATCH
/v1/sessions/{id}
curl -X PATCH \
  /api/v1/sessions/{id} \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Service-CRN: YOUR-SERVICE-CRN' \
  -H 'IBM-API-Version: 2025-05-01' \
  -H 'Content-Type: application/json' \
  -d '{"accepting_jobs":true}'

Responses

Successfully updated session

Close job session

Closes the runtime session. The session stops accepting new jobs and queued jobs will not run. Existing running jobs will run to completion. This is analogous to the cancel() function in Qiskit.

Path Parameters

Name, TypeDescription
id
Required
string

Session Id

HTTP Response Status Codes

Status codeDescription
204Successfully closed runtime session

Code samples

DELETE
/v1/sessions/{id}/close
curl -X DELETE \
  /api/v1/sessions/{id}/close \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Service-CRN: YOUR-SERVICE-CRN' \
  -H 'IBM-API-Version: 2025-05-01'

Responses

Successfully closed runtime session
Was this page helpful?
Report a bug or request content on GitHub.