> 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/async-create-automation/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.airtop.ai/_mcp/server. # Create an automation (async) POST https://api.airtop.ai/api/v1/async/sessions/{sessionId}/windows/{windowId}/create-automation Content-Type: application/json Create an automation of a browser window asynchronously Reference: https://docs.airtop.ai/api-reference/airtop-api/windows/async-create-automation ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Request ### Path parameters - `sessionId` (string, required) — The session id for the window. - `windowId` (string, required) — The Airtop window id of the browser window. ### Body (application/json) This endpoint expects an object. - `async` (AsyncConfig, optional) — Async configuration options. - `clientRequestId` (string, optional) - `configuration` (map from string to any, optional) — Request configuration - `costThresholdCredits` (long, optional) — A credit threshold that, once exceeded, will cause the operation to be cancelled. Note that this is *not* a hard limit, but a threshold that is checked periodically during the course of fulfilling the request. A default threshold is used if not specified, but you can use this option to increase or decrease as needed. Set to 0 to disable this feature entirely (not recommended). - `timeThresholdSeconds` (long, optional) — A time threshold in seconds that, once exceeded, will cause the operation to be cancelled. Note that this is *not* a hard limit, but a threshold that is checked periodically during the course of fulfilling the request. A default threshold is used if not specified, but you can use this option to increase or decrease as needed. Set to 0 to disable this feature entirely (not recommended). This setting does not extend the maximum session duration provided at the time of session creation. ## Response ### 201 Created - `requestId` (string, required) - `errors` (list of Issue, optional) - `warnings` (list of Issue, optional) ## Types ### AsyncConfig - `webhookUrl` (string, optional) — The URL to send the response to when the request is complete. ### 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 **Request** ```json {} ``` **Response** ```json { "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/async/sessions/6aac6f73-bd89-4a76-ab32-5a6c422e8b0b/windows/0334da2a-91b0-42c5-6156-76a5eba87430/create-automation" payload = {} headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```typescript import { AirtopClient } from "@airtop/sdk"; const client = new AirtopClient({ apiKey: "YOUR_API_KEY" }); await client.windows.asyncCreateAutomation("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430"); ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.airtop.ai/api/v1/async/sessions/6aac6f73-bd89-4a76-ab32-5a6c422e8b0b/windows/0334da2a-91b0-42c5-6156-76a5eba87430/create-automation" payload := strings.NewReader("{}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") 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/async/sessions/6aac6f73-bd89-4a76-ab32-5a6c422e8b0b/windows/0334da2a-91b0-42c5-6156-76a5eba87430/create-automation") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.airtop.ai/api/v1/async/sessions/6aac6f73-bd89-4a76-ab32-5a6c422e8b0b/windows/0334da2a-91b0-42c5-6156-76a5eba87430/create-automation") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{}") .asString(); ``` ```php request('POST', 'https://api.airtop.ai/api/v1/async/sessions/6aac6f73-bd89-4a76-ab32-5a6c422e8b0b/windows/0334da2a-91b0-42c5-6156-76a5eba87430/create-automation', [ 'body' => '{}', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.airtop.ai/api/v1/async/sessions/6aac6f73-bd89-4a76-ab32-5a6c422e8b0b/windows/0334da2a-91b0-42c5-6156-76a5eba87430/create-automation"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.airtop.ai/api/v1/async/sessions/6aac6f73-bd89-4a76-ab32-5a6c422e8b0b/windows/0334da2a-91b0-42c5-6156-76a5eba87430/create-automation")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data 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() ```