JavaScript
import Honcho from 'honcho-ai';
const client = new Honcho({
apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted
});
async function main() {
const session = await client.apps.users.sessions.clone('app_id', 'user_id', 'session_id');
console.log(session.id);
}
main();import os
from honcho import Honcho
client = Honcho(
api_key=os.environ.get("HONCHO_API_KEY"), # This is the default and can be omitted
)
session = client.apps.users.sessions.clone(
session_id="session_id",
app_id="app_id",
user_id="user_id",
)
print(session.id)curl --request GET \
--url http://localhost:8000/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/clone \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8000",
CURLOPT_URL => "http://localhost:8000/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/clone",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:8000/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/clone"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("http://localhost:8000/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/clone")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8000/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/clone")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"is_active": true,
"user_id": "<string>",
"app_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"metadata": {}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}sessions
Clone Session
Clone a session, optionally up to a specific message
GET
/
v1
/
apps
/
{app_id}
/
users
/
{user_id}
/
sessions
/
{session_id}
/
clone
JavaScript
import Honcho from 'honcho-ai';
const client = new Honcho({
apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted
});
async function main() {
const session = await client.apps.users.sessions.clone('app_id', 'user_id', 'session_id');
console.log(session.id);
}
main();import os
from honcho import Honcho
client = Honcho(
api_key=os.environ.get("HONCHO_API_KEY"), # This is the default and can be omitted
)
session = client.apps.users.sessions.clone(
session_id="session_id",
app_id="app_id",
user_id="user_id",
)
print(session.id)curl --request GET \
--url http://localhost:8000/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/clone \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8000",
CURLOPT_URL => "http://localhost:8000/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/clone",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:8000/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/clone"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("http://localhost:8000/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/clone")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8000/v1/apps/{app_id}/users/{user_id}/sessions/{session_id}/clone")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"is_active": true,
"user_id": "<string>",
"app_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"metadata": {}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
ID of the app
ID of the user
ID of the session to clone
Query Parameters
Message ID to cut off the clone at
Whether to deep copy metamessages
⌘I