Skip to content

    AeoClient

    Create a server-side client. Each endpoint method sends your key in the Authorization header using the Bearer scheme.

    Signature

    new AeoClient(apiKey: string, options: ClientOptions)

    Parameters

    apiKey
    A scoped AEO API key, without whitespace.
    options.baseUrl
    Required. Pass the HTTPS origin without a version, path, query string or fragment. HTTP is accepted for loopback and testserver.
    options.fetch
    Optional replacement for the global fetch function. Supply a mock to test without a network connection.
    options.retry
    Set maxRetries, baseBackoffMs, maxBackoffMs or maxRetryAfterSeconds to override individual retry settings.
    options.sleep, options.random, options.newKey
    Optional functions for controlling retry delays, jitter and generated request keys in tests.

    Return value

    An AeoClient instance. Creating it sends no request. Its first endpoint call contacts the API.

    Errors

    • Error for an empty key, whitespace in the key, or an invalid base URL.

    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 account = await client.v2GetAccount();
    console.log(account.status, account.body);

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