Thread
curl --request GET \
--url https://api.capy.ai/api/v1/threads/{threadId}/stream \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.capy.ai/api/v1/threads/{threadId}/stream"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.capy.ai/api/v1/threads/{threadId}/stream', 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.capy.ai/api/v1/threads/{threadId}/stream",
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 := "https://api.capy.ai/api/v1/threads/{threadId}/stream"
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("https://api.capy.ai/api/v1/threads/{threadId}/stream")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.capy.ai/api/v1/threads/{threadId}/stream")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"event": "status",
"data": "<string>"
}{
"_tag": "capy/InvalidRequest",
"message": "<string>"
}{
"_tag": "capy/Unauthorized"
}{
"_tag": "capy/Forbidden"
}{
"_tag": "capy/ThreadNotFound",
"threadId": "<string>"
}{
"_tag": "capy/RateLimited",
"retryAfterSeconds": 123
}{
"_tag": "capy/StreamUnavailable"
}streams
Thread
GET
/
api
/
v1
/
threads
/
{threadId}
/
stream
Thread
curl --request GET \
--url https://api.capy.ai/api/v1/threads/{threadId}/stream \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.capy.ai/api/v1/threads/{threadId}/stream"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.capy.ai/api/v1/threads/{threadId}/stream', 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.capy.ai/api/v1/threads/{threadId}/stream",
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 := "https://api.capy.ai/api/v1/threads/{threadId}/stream"
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("https://api.capy.ai/api/v1/threads/{threadId}/stream")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.capy.ai/api/v1/threads/{threadId}/stream")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"event": "status",
"data": "<string>"
}{
"_tag": "capy/InvalidRequest",
"message": "<string>"
}{
"_tag": "capy/Unauthorized"
}{
"_tag": "capy/Forbidden"
}{
"_tag": "capy/ThreadNotFound",
"threadId": "<string>"
}{
"_tag": "capy/RateLimited",
"retryAfterSeconds": 123
}{
"_tag": "capy/StreamUnavailable"
}Authorizations
An API key created in Capy under Settings → API.
Headers
The last id: a client read; the committed lane resumes after it.
Path Parameters
Query Parameters
Exclusive event-ID cursor to start the committed lane after; the Last-Event-ID header wins when both are present.
run: close the stream with done after the run in progress ends, or at once when the thread is not working.
Was this page helpful?
⌘I