List your brands. Filter by brand_ids, and active state.
Method: GET (paginated)
Parameters:
Response:
{
"brands": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name": "string",
"active": true,
"image": "string",
"bio": "string",
"url": "string",
"marketplace": "amazon.com"
}
],
"cursor": "string"
}
Errors:
Example:
const API_KEY = "LEVANTA_API_KEY"
const ENDPOINT = "<https://app.levanta.io/api/seller/v1/brands>"
let cursor;
const brands = [];
// Set up query parameters
const parameters = new URLSearchParams();
parameters.set("limit", 50); // Get 50 brands per response
parameters.set("active", "true"); // Only brands active in Levanta's marketplace
// Paginate through brands, stop when a value of null is returned for "cursor"
while (cursor !== null) {
const response = await fetch(`${ENDPOINT}?${parameters.toString()}`, {
method: "GET",
headers: {
Authorization: `Bearer ${API_KEY}`
}
});
const json = await response.json();
// Store brands returned
brands.push(...json.brands);
cursor = json.cursor;
if (cursor) parameters.set("cursor", cursor);
}
console.log(brands);