v2PostBrands
Create a brand using its name, categories, domains and markets. Use the ID in the response to request reports and start runs for that brand.
See the REST reference for POST /v2/brands.
Signature
v2PostBrands(
body: Record<string, unknown>,
options?: {
signal?: AbortSignal;
idempotencyKey?: string;
},
): Promise<ApiResponse<unknown>>Parameters
body- JSON object for this action. The example includes the fields for default.
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.idempotencyKey- The SDK generates a request key when you omit it. Pass the same key and body to retry this write in a separate call.
Return value
Promise<ApiResponse<unknown>>. HTTP 201 returns the brand, including data.id, data.status and data.revision.
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 body = {
"category_ids": [
"gcid:plumber"
],
"domains": [
"example.com"
],
"markets": [
{
"city": "Chicago",
"country": "US",
"language": "en"
}
],
"name": "Example Plumbing",
"prompts": [
"What should homeowners compare when choosing a plumber in Chicago?",
"How do I find a plumber for an emergency repair in Chicago?"
],
"schedule": {
"enabled": false
}
};
const response = await client.v2PostBrands(body);
console.log(response.status, response.body);Requests by feature
Brands, locations and connections
See TypeScript client setup for authentication, timeouts and retry settings.