Skip to content

    v2GetPrompts

    Browse the prompt library or request prompt coverage, history, topics or an export. Start with the library to find prompt IDs.

    See the REST reference for GET /v2/prompts.

    Signature

    v2GetPrompts(
      options?: {
        signal?: AbortSignal;
        audience_id?: string | null;
        brand_id?: string;
        category_id?: string | null;
        country?: string | null;
        cursor?: string | null;
        format?: "json" | "csv";
        group_id?: string | null;
        id?: string;
        include_archived?: boolean;
        intent?: "discovery" | "recommendation" | "evaluation" | "pricing" | "comparison" | "alternatives" | "use_case" | "transaction" | "local" | "troubleshooting" | "trust" | "informational" | null;
        language?: string | null;
        limit?: number;
        mode?: "unbranded" | "branded" | "all";
        offset?: number;
        product_id?: string | null;
        prompt_id?: string;
        q?: string | null;
        query?: string;
        scope?: "shared" | "private";
        service_id?: string | null;
        source?: "all" | "crm" | "profile";
        stage?: "awareness" | "consideration" | "evaluation" | "decision" | "retention" | null;
        status?: "active" | "archived" | null;
        tag?: string | null;
        view?: "library" | "coverage" | "export" | "suggestions" | "metadata" | "history" | "topic_suggestions" | "sets" | "topics";
        website?: string | null;
      },
    ): Promise<ApiResponse<unknown>>

    Parameters

    options
    Pass the named options in the signature. The selected action or view determines which fields are required.
    options.signal
    Optional AbortSignal to cancel the HTTP request.
    options.limit
    integer. limit
    options.view
    "library".

    Return value

    Promise<ApiResponse<unknown>>. The library returns prompt records in body.data and the next cursor in body.meta.next_cursor. A CSV export returns a string in body.

    Errors

    • The SDK throws AeoApiError if the API returns an error. Inspect status, code, fieldErrors and requestId.
    • AeoTransportError means the request failed to connect or the client could not finish reading a successful response. Invalid JSON in a successful response throws SyntaxError. If you abort the request, the SDK throws the reason from the AbortSignal.
    • For HTTP 422, check fieldErrors for the input field and validation message.

    TypeScript example

    import { AeoClient } from "@aeoapi/aeo-sdk";
    
    const apiKey = process.env.AEO_API_KEY;
    if (!apiKey) throw new Error("Set AEO_API_KEY on your server.");
    const client = new AeoClient(apiKey, { baseUrl: "https://api.aeoapi.dev" });
    
    const response = await client.v2GetPrompts({
      "view": "library",
      "limit": 25
    });
    console.log(response.status, response.body);

    Requests by feature

    Prompts and topics

    See TypeScript client setup for authentication, timeouts and retry settings.