Execute Xquik API requests
executeExecute JavaScript against Xquik's X (Twitter) API. Reads cost 1 credit per result, 2 per analyzed post & 5 per article. 1,000 credits cost $0.12-$0.15. Writes cost 10 credits & posts from 30. Empty & failed reads are free. First use the search tool to find endpoints, parameters & response schemas. The sandbox declares interface XquikRequest { path: string; method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE"; query?: Record<string, string | number | boolean | undefined>; body?: unknown } declare const xquik: { result: unknown; request<T = unknown>(options: XquikRequest): Promise<T> }. request() returns the body as the API sends it, as the response schema from search describes it. code is an async arrow function. Fields use snake_case, & camelCase reads work too. A missing field reads as undefined & warns with the available keys. An absent field may need a request parameter. Output holds up to 24,000 characters, so large arrays fit after projection. A call ends at 55 s, waits included. A post can take 1 minute. Wait between calls. Paged reads return a cursor. Run independent reads with Promise.all. A result_id from an earlier answer lets a later call project its saved data through xquik.result. Authentication & idempotency headers are injected, so code holds no credentials. The sandbox has no filesystem or general network access. A failed request throws an Error naming its method, path, HTTP status & request ID, then the API's error body.
Example
async () => xquik.request({ path: "<path from search>" })Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"code": "<code>"
},
"name": "execute"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | JavaScript async arrow function that calls xquik.request(). | |
| result_id | No | Saved result ID from an earlier answer. Leave it out unless an answer gave you one. Read its data through xquik.result. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes | JSON returned by the executed async function. | |
| warnings | No | Missing field names mapped to available keys. Optional fields may require explicit request parameters. Absence does not prove the data is unavailable. | |
| truncated | No | Present when the answer was over 24,000 characters & result holds a shortened copy. |