Skip to content

Quick start

Get from zero to a 200 OK in two steps.

You’ll need a Spate account and a terminal.

  1. Generate an API key

    Go to app.spate.nyc/settings/api, generate your key and copy it somewhere safe.

    Keys are shown only once.

    See Authentication for the full flow.

  2. Make your first call

    In your terminal, export the key and hit the Top 5 Trends endpoint:

    Terminal window
    export SPATE_API_KEY="__paste_your_secret_key_here__"
    # Top 5 US Beauty trends
    curl "https://api.spate.nyc/v1/latest/cat1/trends/top5/popindex/us/6d408533-6979-43aa-80af-4d88bf0be860" \
    -H "Authorization: Bearer $SPATE_API_KEY"

    A 200 OK means everything is working.

    For other responses, see the endpoint reference.

  3. Validate the data

    Using jq and column, you can extract and format part of the response.

    To view the data as a table, and compare it to the dashboard:

    Terminal window
    export SPATE_API_KEY="__paste_your_secret_key_here__"
    response=$(curl "https://api.spate.nyc/v1/latest/cat1/trends/top5/popindex/us/6d408533-6979-43aa-80af-4d88bf0be860" \
    -H "Authorization: Bearer $SPATE_API_KEY")
    echo "# Dashbord URL: $(echo $response | jq -r '.data.dashboard')"
    echo "# Data:"
    echo "$response" | jq -r '
    ["Rank", "Trend", "Popularity", "YoY", "YoY prediction"],
    (.data.trends[] | [.rank, .cat5_label, .popularity, .yoy_percent_increase, .yoy_percent_increase_prediction])
    | @tsv
    ' | column -t -s $'\t'