/api/v1/live/sessions/{id}Stops the session. The session keeps what its frames cost; the rest of the credits it held go back to your balance. Stopping a session that has already stopped returns it unchanged.
Path parameters#
| Parameter | Type | Description |
|---|---|---|
id required |
integer |
Session id. |
Responses#
200#
The stopped session.
-
idinteger requiredSession id.
-
sourcestring requiredOne of:
url,camera.url(a stream watched by our servers) orcamera(frames you send). -
urlstring or null requiredThe stream address;
nullfor camera sessions. -
fpsnumber requiredFrames checked per second.
-
modestring requiredOne of:
detect,capture,censor.detect,captureorcensor. -
censorStylestring or null requiredOne of:
blur,pixelate,box,null. How the moments' censored copies hide what was found;nullunlessmodeiscensor. -
trackingboolean requiredWhether findings are followed from frame to frame (see
trackingwhen starting). -
frameSideinteger requiredLong side, in pixels, of the pictures kept.
-
momentEveryinteger requiredSeconds at least between two kept moments.
-
statusstring requiredOne of:
running,stopped,ended,failed.stopped: by you or when the credits ran out.ended: the stream ended.failed: the stream could not be watched. -
reasonstring or null requiredWhy the session is no longer running.
-
framesCheckedinteger requiredFrames checked so far.
-
framesFlaggedinteger requiredFrames that raised at least one flag.
-
momentsinteger requiredFlagged frames kept, with their picture, in your moderation history.
-
creditsChargedinteger requiredCredits taken from your balance for the session. While it runs this includes the minute held ahead; when it ends, what its frames did not use goes back and this is what the session cost.
-
creditsUsedinteger requiredWhat the frames checked so far cost: each frame costs
costPerMinute / (60 x fps), rounded up to whole credits for the session, and never more thancreditsCharged. Equal tocreditsChargedonce the session has ended. -
costPerMinuteinteger requiredWhat a minute at the session's rate costs: the credits held ahead each minute.
-
startedAtinteger requiredUnix time, seconds.
-
endedAtinteger or number or null requiredUnix time, seconds;
nullwhile running. -
jobIdinteger or null requiredThe session's entry in your moderation history.
-
widthintegerStream sessions while running: the stream's width.
-
heightintegerStream sessions while running: the stream's height.
-
flagsarray or null requiredThe flags checked on every frame, as chosen at the start;
null: every flag. -
metadataobjectThe session's
metadata, unchanged, when you sent one.
401#
Missing, unknown, revoked or expired API key, or the account is not active.
{
"error": "unauthorized",
"message": "The API key is not valid."
}403#
The key may not do this: a read key on a write endpoint, or a restricted key.
{
"error": "forbidden",
"message": "This API key does not have write permission"
}404#
No session with this id for this account.
{
"error": "not_found",
"message": "No such live session."
}429#
Too many requests in a minute. Wait Retry-After seconds. See Rate limits.
Header Retry-After: Seconds to wait.
{
"error": "too_many_requests",
"message": "Too many requests. Try again in a minute."
}Request
curl -X DELETE https://api.detectivision.ai/api/v1/live/sessions/{id} \
-H "Api-Key: $DETECTIVISION_API_KEY"import os, requests
r = requests.delete(
"https://api.detectivision.ai/api/v1/live/sessions/{id}",
headers={"Api-Key": os.environ["DETECTIVISION_API_KEY"]},
)
print(r.status_code, r.json())const res = await fetch("https://api.detectivision.ai/api/v1/live/sessions/{id}", {
method: "DELETE",
headers: {
"Api-Key": process.env.DETECTIVISION_API_KEY,
},
});
console.log(res.status, await res.json());Response 200
{
"id": 31,
"source": "url",
"url": "rtsp://cams.example.com/live",
"fps": 1,
"mode": "capture",
"censorStyle": null,
"tracking": false,
"frameSide": 1280,
"momentEvery": 3,
"status": "stopped",
"reason": "Stopped by the owner.",
"framesChecked": 94,
"framesFlagged": 3,
"moments": 2,
"creditsCharged": 4,
"creditsUsed": 4,
"costPerMinute": 2,
"startedAt": 1790505000,
"endedAt": 1790505095,
"jobId": 2210
}