Write to the Logflare API
execute_writeWrite JavaScript to send state-changing requests (POST, PUT, PATCH, DELETE) to the Logflare Management API, enabling resource creation and updates.
Instructions
Call the Logflare Management API by writing JavaScript, including state-changing requests (POST/PUT/PATCH/DELETE). Use execute_read for plain reads.
Example: async () => (await api.request({ method: 'POST', path: '/api/sources', body: { name: 'my-source' } })).data
Your code is an async arrow function that returns a value. In scope:
declare const api: { request<T = unknown>(options: { method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE"; // default GET path: string; // e.g. "/api/sources" — see the search tool query?: Record<string, string | number | boolean | undefined>; body?: unknown; // JSON by default contentType?: string; // overrides the default application/json rawBody?: boolean; // send body as-is (no JSON.stringify) }): Promise<{ status: number; ok: boolean; data: T }>; };
Returns a JSON object — result (or error), calledEndpoints, and stdout/stderr — wrapped in an untrusted-data envelope. Use the search tool first to find paths. Access-token, backend, and team endpoints (/api/access-tokens, /api/backends, /api/teams) are blocked — they mint/reveal access tokens, backend connection config, or the account's master API key.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Async arrow function using `api`; must return a value. |