Skip to main content

New Introducing the Holiday Hub — seasonal templates and ideas to plan your holiday campaigns in one place.Introducing the Holiday Hub.Explore the Holiday Hub

Entries API

Max plan Last reviewed

The Entries API lets a developer pull entry data from your ShortStack account into another system, using the same filters as the Entries Manager. It's included in the Max plan and higher. The quickest start is Actions > Explore Entries API in the Entries Manager, which creates an API key and a ready-made request for the entries you've filtered.

Which tool you need

You want toUse
Pull entries into your own system or script on demandThe Entries API (this article)
Send each new entry to Mailchimp, HubSpot, Klaviyo or another service as it arrivesForm integrations
Connect to a service without a built-in integration, without codeA webhook with Zapier
Download entries as a spreadsheetExporting entry data

Before you start

  • The Entries API is included in the Max plan and higher. See plans on the pricing page.
  • It's for developers. You'll need to be comfortable making HTTP requests, such as with curl.
  • Every request needs your API key in this header: Authorization: Token token=YOUR_API_KEY. Keep the key private, like a password.
  • Responses are JSON, in the form { "data": [...] }. Errors return a short message and a status code, such as 401 for a bad key or 404 for an entry that can't be found.

Get an API key and a ready-made request

  1. Open the Entries Manager.
  2. Filter to the entries you want, such as one list. This step is optional.
  3. Click Actions, then Explore Entries API.
  4. Choose an existing API key, or follow the steps to create one.
  5. Copy the curl command. It includes the filters you set in the Entries Manager.

Make a request

Fetch the first 25 entries:

curl -i -H "Authorization: Token token=$API_KEY" \
  "https://entries.shortstack.com/entries?per_page=25"

Sample response:

{
  "data": [
    {
      "id": 12345,
      "campaign_id": 678,
      "list_id": 91011
    }
  ]
}

To get one entry, add its ID. Add a profile to choose which fields come back:

curl -i -H "Authorization: Token token=$API_KEY" \
  "https://entries.shortstack.com/entries/12345?profile=42"

Page through results

  1. Run your request with -i, so the response headers are shown:

    curl -i -H "Authorization: Token token=$API_KEY" \
      "https://entries.shortstack.com/entries?sort=received&direction=descending&per_page=50"
    
  2. Find the Link: header, and copy the address inside <> that ends with rel="next".

  3. Request that address to get the next page:

    curl -i -H "Authorization: Token token=$API_KEY" \
      "https://entries.shortstack.com/entries?sort=received&direction=descending&per_page=50&last_id=45678&last_sort=2024-04-10T16:45:00Z"
    
  4. Repeat until there's no rel="next" link. That's the last page.

To start again from the first page with the same filters, request the address that ends with rel="first".

Paging and sorting parameters

ParameterWhat it does
per_pageHow many entries to return. The default is 100 and the maximum is 5,000.
sortThe field to order results by. The default is id.
directionascending or descending.
last_idThe last id on the previous page. It's included in the next link.
last_sortThe last value of your sort field on the previous page, when sorting by anything other than id. It's included in the next link.

Filter parameters

Combine filters by joining them with &. For a range, write min,max, and leave one side blank for an open-ended range, such as age=18,.

ParameterFilters byExample
campaignOne or more campaign IDscampaign=1,2
listOne or more list IDslist=12,34
list_tagOne or more list tag nameslist_tag=spring
feedOne or more social media feed IDsfeed=56
exclude_feedstrue or 1 for only entries not from a feed, unless feed is also sentexclude_feeds=true
categoryOne or more category namescategory=Photos
city, province, postal_codeOne or more city, state or province, or postal or ZIP codes. Dashes in postal codes are ignored.province=Oregon
countryOne or more country codes or namescountry=US
labelOne or more labelslabel=winner
emailOne exact email addressemail=name@example.com
searchText across indexed fields. Email addresses match exactly.search=winner
receivedA date range, in ISO 8601received=2024-01-01,2024-01-31
ageAn age rangeage=18,
idAn entry ID rangeid=1000,2000
votes1, votes2, votes3A vote count range for that voting roundvotes1=10,20
image_width, image_heightAn image size range, in pixelsimage_width=1080,
recaptcha_scoreA reCAPTCHA score range, as decimalsrecaptcha_score=0.5,1
approvedApproval: true, false, 1 or 0approved=true
image, videotrue or false to require an image or videoimage=true
testtrue or false to find test entriestest=true
profileAn export profile ID, which sets the fields returnedprofile=42
es_boolean_X, es_date_X, es_number_X, es_list_XA custom field in your export profile, where X is the number shown in the profile. Date and number take a range, and list takes one or more values.es_list_2=VIP,Priority

For example, approved entries from the United States received in the first quarter of 2024:

curl -i -H "Authorization: Token token=$API_KEY" \
  "https://entries.shortstack.com/entries?per_page=50&country=US&approved=true&received=2024-01-01,2024-03-31"

If something goes wrong

What you seeWhat to do
401The API key is missing or wrong. Check the header is exactly Authorization: Token token=YOUR_API_KEY, or create a new key in the API Explorer.
404 for one entryThe entry doesn't exist, or it belongs to another account. Check the ID.
Only 100 entries come backThat's the default page size. Set per_page, up to 5,000, and follow the next links for the rest.
You can't find the next linkRun the request with -i so headers are shown. If there's no rel="next", you're on the last page.
Fewer entries than you expectedCheck your filters. A range is written min,max, with a comma, and email matches only the exact address.
Custom fields aren't in the responseAdd profile= with an export profile that includes them.

FAQs

Where do I get an API key?

In the Entries Manager, click Actions, then Explore Entries API. The API Explorer lets you choose an existing key or create a new one.

How many entries can one request return?

Up to 5,000. Set per_page to choose how many; without it, you get 100. To get more, follow the next link in the response headers.

Can I send entries to my CRM without writing code?

Yes. Use a form integration, such as Mailchimp, HubSpot or Klaviyo, or a webhook through Zapier. See Form integrations.

Can the API return only the fields I need?

Yes. Add profile= with the ID of an export profile. The response then uses that profile's fields.

Was this helpful?