> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.airtop.ai/api-reference/airtop-api/windows/close/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.airtop.ai/_mcp/server. # Close window DELETE https://api.airtop.ai/api/v1/sessions/{sessionId}/windows/{windowId} Closes a browser window in a session Reference: https://docs.airtop.ai/api-reference/airtop-api/windows/close ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Request ### Path parameters - `sessionId` (string, required) — ID of the session that owns the window. - `windowId` (string, required) — Airtop window ID of the browser window. ## Response ### 200 OK - `data` (WindowId, required) - `meta` (EnvelopeDefaultMeta, required) - `errors` (list of Issue, optional) - `warnings` (list of Issue, optional) ## Types ### WindowId - `targetId` (string, required) — CDP Window target ID - `windowId` (string, required) — Airtop window ID of the browser window - `title` (string, optional) — Current title of the browser window - `url` (string, optional) — Current URL of the browser window ### EnvelopeDefaultMeta - `requestId` (string, optional) ### Issue - `message` (string, required) — Message describing the issue. - `code` (string, optional) — Issue code. - `details` (map from string to any, optional) — Any associated details. - `reason` (string, optional) — Underlying reason for the issue. ## Examples **Response** ```json { "data": { "targetId": "targetId", "windowId": "windowId", "title": "title", "url": "url" }, "meta": { "requestId": "requestId" }, "errors": [ { "message": "message", "code": "code", "details": { "key": "value" }, "reason": "reason" } ], "warnings": [ { "message": "message", "code": "code", "details": { "key": "value" }, "reason": "reason" } ] } ``` **SDK Code** ```python import requests url = "https://api.airtop.ai/api/v1/sessions/6aac6f73-bd89-4a76-ab32-5a6c422e8b0b/windows/7334da2a-91b0-42c5-6156-76a5eba87430" headers = {"Authorization": "Bearer "} response = requests.delete(url, headers=headers) print(response.json()) ``` ```typescript import { AirtopClient } from "@airtop/sdk"; const client = new AirtopClient({ apiKey: "YOUR_API_KEY" }); await client.windows.close("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "7334da2a-91b0-42c5-6156-76a5eba87430"); ``` ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.airtop.ai/api/v1/sessions/6aac6f73-bd89-4a76-ab32-5a6c422e8b0b/windows/7334da2a-91b0-42c5-6156-76a5eba87430" req, _ := http.NewRequest("DELETE", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.airtop.ai/api/v1/sessions/6aac6f73-bd89-4a76-ab32-5a6c422e8b0b/windows/7334da2a-91b0-42c5-6156-76a5eba87430") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Delete.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.delete("https://api.airtop.ai/api/v1/sessions/6aac6f73-bd89-4a76-ab32-5a6c422e8b0b/windows/7334da2a-91b0-42c5-6156-76a5eba87430") .header("Authorization", "Bearer ") .asString(); ``` ```php request('DELETE', 'https://api.airtop.ai/api/v1/sessions/6aac6f73-bd89-4a76-ab32-5a6c422e8b0b/windows/7334da2a-91b0-42c5-6156-76a5eba87430', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.airtop.ai/api/v1/sessions/6aac6f73-bd89-4a76-ab32-5a6c422e8b0b/windows/7334da2a-91b0-42c5-6156-76a5eba87430"); var request = new RestRequest(Method.DELETE); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://api.airtop.ai/api/v1/sessions/6aac6f73-bd89-4a76-ab32-5a6c422e8b0b/windows/7334da2a-91b0-42c5-6156-76a5eba87430")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "DELETE" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```