Export cookies to a file
A Netscape cookie file in the workspace, for curl or wget in the shell. 409 browser_disabled on a session created with browser: false.
POST
/v1/sessions/{id}/browser/export-cookiesRequest
| Method and path | POST/v1/sessions/{id}/browser/export-cookies |
|---|---|
| Base URL | https://api.boxline.dev |
| Authentication | Your API key in the x-api-key header (or Authorization: Bearer). The examples read it from BOXLINE_API_KEY. |
Path parameters
| Name | Type | Default | Allowed values | Description |
|---|---|---|---|---|
idrequired | string | – | – |
Body
JSON with content-type: application/json. Optional: you can leave the body out.
| Name | Type | Default | Allowed values | Description |
|---|---|---|---|---|
path | string | cookies.txt | – |
curl -X POST "https://api.boxline.dev/v1/sessions/$SESSION_ID/browser/export-cookies" \ -H "x-api-key: $BOXLINE_API_KEY"import { Boxline } from "@boxline/sdk";const bx = new Boxline(); // reads BOXLINE_API_KEY and BOXLINE_API_URLconst { path, count } = await bx.sessions.exportCookies("SESSION_ID"); // cookies.txtawait bx.sessions.exec("SESSION_ID", `curl -b ${path} https://example.com/account`);from boxline import Boxlinebx = Boxline() # reads BOXLINE_API_KEY and BOXLINE_API_URLresult = bx.sessions.export_cookies("SESSION_ID") # cookies.txtbx.sessions.exec("SESSION_ID", f"curl -b {result['path']} https://example.com/account")Responses
200 OK
The file and how many cookies it holds.
Fields
| Name | Type | Default | Allowed values | Description |
|---|---|---|---|---|
path | string | – | – | |
count | integer | – | – |
{ "path": "/workspace/downloads/report.csv", "count": 0}Errors
Errors have a matching HTTP status and the same body. code is stable, so check it in your code; message is for people. See Errors and request ids.
| Status | Codes | When |
|---|---|---|
| 401 Unauthorized | unauthorized | Missing or invalid API key. |
| 404 Not Found | not_found, invite_not_found, provider_unavailable | No such thing in this project (or organization), or no such route. |
| 409 Conflict | session_not_running, shell_disabled, browser_disabled, nothing_saved, not_resumable, invalid_state, conflict, email_taken, identity_in_use, provider_already_linked, last_sign_in_method, not_impersonating, machine_too_old, too_many_credential_values, limit_reached, terms_version_mismatch, no_project, last_owner, organization_not_empty, project_has_sessions, already_member, invite_pending, idempotency_in_progress | The current state does not allow it, or a request with this Idempotency-Key is still being answered. |
{ "error": { "code": "not_found", "message": "session not found", "requestId": "req_4fJx0aQm2Lk9Pz7N" }}Learn more
These docs describe a beta API. Endpoints, fields and SDK methods may change before general availability; breaking changes will be listed in the changelog.