curl --request PUT \
--url https://api.example.com/v1/sessions/{session_id}/complete \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"attendance": "<string>",
"completed_at": "<string>"
}
'import requests
url = "https://api.example.com/v1/sessions/{session_id}/complete"
payload = {
"attendance": "<string>",
"completed_at": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({attendance: '<string>', completed_at: '<string>'})
};
fetch('https://api.example.com/v1/sessions/{session_id}/complete', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/sessions/{session_id}/complete",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'attendance' => '<string>',
'completed_at' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/sessions/{session_id}/complete"
payload := strings.NewReader("{\n \"attendance\": \"<string>\",\n \"completed_at\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.example.com/v1/sessions/{session_id}/complete")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"attendance\": \"<string>\",\n \"completed_at\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/sessions/{session_id}/complete")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"attendance\": \"<string>\",\n \"completed_at\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"status": "<string>",
"title": "<string>",
"tutor_id": "<string>",
"student_id": "<string>",
"starts_at": "<string>",
"ends_at": "<string>",
"duration_minutes": 123,
"tutor_pay_rate_cents": 123,
"student_rate_cents": 123,
"amount_owed_cents": 123,
"mode": "<string>",
"subject_id": "<string>",
"created_at": "<string>",
"completed_at": "<string>"
}{
"error": {
"code": "not_found",
"message": "Session not found",
"status": 404,
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "Session not found",
"status": 404,
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "Session not found",
"status": 404,
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "Session not found",
"status": 404,
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "Session not found",
"status": 404,
"details": {}
}
}Complete Session
Mark a session completed.
Sets tutor_sessions.status='completed' and writes one tutor-owed
session_ledger row per participant from that participant’s per-hour rate
snapshot, atomically via a transactional RPC. Idempotent — completing an
already-completed session is a no-op replay, never a double-ledger. No charge is
initiated here. Requires the sessions:write scope. 404 if the session isn’t in
your org.
curl --request PUT \
--url https://api.example.com/v1/sessions/{session_id}/complete \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"attendance": "<string>",
"completed_at": "<string>"
}
'import requests
url = "https://api.example.com/v1/sessions/{session_id}/complete"
payload = {
"attendance": "<string>",
"completed_at": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({attendance: '<string>', completed_at: '<string>'})
};
fetch('https://api.example.com/v1/sessions/{session_id}/complete', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/sessions/{session_id}/complete",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'attendance' => '<string>',
'completed_at' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/sessions/{session_id}/complete"
payload := strings.NewReader("{\n \"attendance\": \"<string>\",\n \"completed_at\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.example.com/v1/sessions/{session_id}/complete")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"attendance\": \"<string>\",\n \"completed_at\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/sessions/{session_id}/complete")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"attendance\": \"<string>\",\n \"completed_at\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"status": "<string>",
"title": "<string>",
"tutor_id": "<string>",
"student_id": "<string>",
"starts_at": "<string>",
"ends_at": "<string>",
"duration_minutes": 123,
"tutor_pay_rate_cents": 123,
"student_rate_cents": 123,
"amount_owed_cents": 123,
"mode": "<string>",
"subject_id": "<string>",
"created_at": "<string>",
"completed_at": "<string>"
}{
"error": {
"code": "not_found",
"message": "Session not found",
"status": 404,
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "Session not found",
"status": 404,
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "Session not found",
"status": 404,
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "Session not found",
"status": 404,
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "Session not found",
"status": 404,
"details": {}
}
}Authorizations
Org API key as Token token=ei_live_...
Headers
Path Parameters
Body
PUT /v1/sessions/{id}/complete → tutor_sessions.status + session_ledger.
Marks a scheduled session completed and writes one tutor-owed session_ledger
row per participant from that participant's per-hour rate snapshot. Idempotent:
completing an already-completed session is a no-op replay, never a double-ledger.
Both fields are persisted: attendance sets each participant's attendance +
settlement_state (and excused books 0 owed), mirroring the in-app
mark_session_attendance; completed_at is stored on tutor_sessions.completed_at.
Response
Successful Response
Was this page helpful?