> Call POST /v1/check before a tool that writes. DENY means do not invoke the tool. For clean Markdown of any page, append .md to the page URL. For the complete index, fetch https://docs.withwrit.com/llms.txt. # Execute a gated upstream request POST https://api.withwrit.com/v1/execute Content-Type: application/json Runs one request against the fixed upstream host for the enrolled system (Stripe: `https://api.stripe.com`). Requires a valid lease id or ALLOW token; the provided method/path/body must byte-match the lease. On any mismatch, expired/reused lease, revoked credential, or gate error the call fails closed with a receipt and no upstream request is made. Body must be JSON and ≤ 1 MB; `idempotencyKey` is passed through to Stripe. Reference: https://docs.withwrit.com/api-reference/enforcement/execute-a-gated-upstream-request ## Servers - `https://api.withwrit.com` (Writ gate, default) - `https://j72ckh66ukck2kcbq3oiwxaalm0olxwb.lambda-url.us-east-1.on.aws` (Direct Lambda Function URL (fallback)) ## Request ### Body (application/json) This endpoint expects an object. - `systemId` (string, required) - `method` (string, required) - `path` (string, required) — must begin /v1/ - `leaseId` (string, optional) - `token` (string, optional) — ALLOW token (lease created implicitly) - `body` (V1ExecutePostRequestBodyContentApplicationJsonSchemaBody, optional) - `idempotencyKey` (string, optional) ## Response ### 200 Upstream response body verbatim on success. On a fail-closed guardrail the response is `{"ok": false, "reason": ..., "upstreamCalled": false}`. ## Errors ### 400 Bad Request Error Missing fields, invalid systemId, or path not starting with /v1/. - `any` ## Types ### V1ExecutePostRequestBodyContentApplicationJsonSchemaBody ## Examples **Request** ```json { "systemId": "stripe", "method": "string", "path": "string" } ``` **Response** ```json {} ``` **SDK Code** ```python import requests url = "https://api.withwrit.com/v1/execute" payload = { "systemId": "stripe", "method": "string", "path": "string" } headers = {"Content-Type": "application/json"} response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.withwrit.com/v1/execute'; const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"systemId":"stripe","method":"string","path":"string"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.withwrit.com/v1/execute" payload := strings.NewReader("{\n \"systemId\": \"stripe\",\n \"method\": \"string\",\n \"path\": \"string\"\n}") req, _ := http.NewRequest("POST", url, payload) 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.withwrit.com/v1/execute") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = 'application/json' request.body = "{\n \"systemId\": \"stripe\",\n \"method\": \"string\",\n \"path\": \"string\"\n}" 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.withwrit.com/v1/execute") .header("Content-Type", "application/json") .body("{\n \"systemId\": \"stripe\",\n \"method\": \"string\",\n \"path\": \"string\"\n}") .asString(); ``` ```php request('POST', 'https://api.withwrit.com/v1/execute', [ 'body' => '{ "systemId": "stripe", "method": "string", "path": "string" }', 'headers' => [ 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.withwrit.com/v1/execute"); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"systemId\": \"stripe\",\n \"method\": \"string\",\n \"path\": \"string\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Content-Type": "application/json"] let parameters = [ "systemId": "stripe", "method": "string", "path": "string" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.withwrit.com/v1/execute")! 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() ```