1. Sequences
  2. Retrieve Sequence

Sequences

Retrieve Sequence

GET
`/v1/sequences/:sequence`

Get a single sequence using its id.

js
        const response = await fetch("https://api.packagex.io/v1/sequences/seq_dxEBJ9bS6gyZhxsmrrUMrM", {
  method: "GET",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
}).then((res) => res.json());

const sequence = response.data;

      

List Sequences

GET
`/v1/sequences`

When you want to retrieve multiple sequences, your data property on the result will always be an array even if you don't have any sequences.

js
        const response = await fetch("https://api.packagex.io/v1/sequences", {
  method: "GET",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
}).then((res) => res.json());

const sequences = response.data; //the array of sequences
const pagination = response.pagination; //the pagination object

      

Pagination

If the has_more property on the pagination object is set to true, there are more sequences in the database that have not been returned. The pagination object also has a page property indicating your current offset and a limit property. The total_count property returns the total number of sequences in the database.

By default the page is set to 1 and the limit is 25.

js
        const response = await fetch("https://api.packagex.io/v1/sequences?page=2&limit=25", {
  method: "GET",
  headers: {
    "PX-API-KEY": process.env.PX_API_KEY,
    "Content-Type": "application/json",
  },
}).then((res) => res.json());

const sequences = response.data;
const pagination = response.pagination;