Skip to main content
POST
/
api
/
v1
/
form-filling
/
session
/
{ambient_session_id}
/
end
cURL
curl --request POST \
  --url https://sdp.suki.ai/api/v1/form-filling/session/<ambient_session_id>/end \
  --header 'sdp_suki_token: <sdp_suki_token>' \
  --header 'sdp_provider_id: <sdp_provider_id>'
{}
Use this endpoint to end a form-filling ambient session. Use your session identifier to identify the session you want to end.
At least one template must be provided in form-filling session context before you end the form-filling ambient session.

Code examples

The code examples below use placeholders and the stage host sdp.suki-stage.com only as examples. For credentials, base URLs, where to run Python or TypeScript, CORS, and cURL, refer to Using code examples in your integration in the API Reference Guidelines.
from typing import Any, Optional

import requests

BASE_URL = "https://sdp.suki-stage.com"


class ApiHttpError(RuntimeError):
    """Wrong HTTP status; OpenAPI errors usually include JSON with message + code."""

    def __init__(self, status: int, url: str, detail: str) -> None:
        super().__init__(f"HTTP {status} {url}: {detail}")
        self.status = status
        self.url = url


def _post_expect_json_object(url: str, headers: dict[str, str], expect_status: int) -> dict[str, Any]:
    r = requests.post(url, headers=headers, timeout=60)
    if r.status_code == expect_status:
        data = r.json()
        if isinstance(data, dict):
            return data
        raise ApiHttpError(expect_status, url, "response JSON was not an object")

    detail = ""
    try:
        err = r.json()
        if isinstance(err, dict) and isinstance(err.get("message"), str):
            detail = err["message"]
    except ValueError:
        detail = (r.text or "")[:500]
    raise ApiHttpError(r.status_code, url, detail or "(no body)")


def end_form_filling_session(suki_token: str, ambient_session_id: str) -> None:
    """POST /api/v1/form-filling/session/{ambient_session_id}/end (sdp_suki_token header required). HTTP 200."""
    url = f"{BASE_URL}/api/v1/form-filling/session/{ambient_session_id}/end"
    headers = {"sdp_suki_token": suki_token, "sdp_provider_id": "<sdp_provider_id>"}
    _post_expect_json_object(url, headers, 200)


if __name__ == "__main__":
    try:
        end_form_filling_session("YOUR_SUKI_TOKEN", "YOUR_AMBIENT_SESSION_ID")
        print("Session ended.")
    except (ApiHttpError, ValueError) as e:
        print(e)

Headers

sdp_suki_token
string
required

sdp_suki_token

sdp_provider_id
string

Unique identifier for the provider. Optional for standard partners. Required for Single Auth Token authentication, where multiple providers share the same partner_token.

Example:

"provider-123"

Path Parameters

ambient_session_id
string
required

ambient_session_id

Response

Success Response

The response is of type object.

Last modified on June 12, 2026