List all links. Filter by ASINs, link IDs, and sources.

Method: GET (paginated)

Parameters:

Response:

{
  "links": [
    {
      "asin": "string",
      "id": "string",
      "sourceId": "string",
      "sourceSubId": "string",
      "sourceName": "string",
      "url": "string",
      "active": true,
      "type": "product",
      "marketplace": "amazon.com"
    }
  ],
  "cursor": "string"
}

Errors:

Example:

const API_KEY = "LEVANTA_API_KEY";
const ENDPOINT = "<https://app.levanta.io/api/creator/v1/links>";

let cursor;
const links = [];

// Set up query parameters
const parameters = new URLSearchParams();
// Get 50 links per response
parameters.set("limit", 50);
// Limit links to two links by their IDs
parameters.set("link_ids", "lv_t7k6xaVsiym8uU5mSl,lv_OQgghVZKul3NS88CRp");
 // Only links created for products with given asins
parameters.set("asins", "B0B7CTHJ2V,B0B4WRTLNR,B086R3CBDB");
// Limit links to ones created with the "default" id
parameters.set("source_ids", "default");

// Paginate through links, 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 links returned
	  links.push(...json.links);
    cursor = json.cursor;
    if (cursor) parameters.set("cursor", cursor);
}
console.log(links);