Create an API key and make your first API call
Create a key in the app, call the API with curl and read the results.
What you will learn#
- How to create an API key and keep it safe.
- How to check your balance with curl.
- How to start a scrape, check on it and read the results.
- Where to go next: the endpoint reference and the AI assistant (MCP) page.
Before you start: you need an account (see Getting started) and a terminal with curl. Time to complete: about 10 minutes.
Create an API key#
Step 1 Open API keys
In the sidebar, under Developers, click API keys. You can also open the API keys page. The page has a New key box at the top and a table of your keys below.
Step 2 Name the key and create it
Step 3 Copy the key now
Step 4 Check the key in the table
Make your first API call#
Step 5 Save the key in your terminal
Put the key in an environment variable, so you do not paste it into every command. Replace the value with your own key.
export SOCIALHOLMES_KEY="sh_your_key_here"
Step 6 Check your balance
Step 7 Start a run
Now ask for a profile. The API does what the Collect data page does: you choose a platform and an endpoint, then send the inputs under parameters and a limit.
curl -X POST https://api.socialholmes.com/api/public/v1/scrape/instagram/profile \
-H "Authorization: Bearer $SOCIALHOLMES_KEY" \
-H "Content-Type: application/json" \
-d '{ "parameters": { "username": "natgeo" }, "limit": 1 }'
The answer comes back at once with status 202. It has a run id and a status of queued. Copy the id.
Step 8 Check the run
Runs are asynchronous. Replace RUN_ID with your id and ask again until the status is succeeded.
curl https://api.socialholmes.com/api/public/v1/runs/RUN_ID \
-H "Authorization: Bearer $SOCIALHOLMES_KEY"
The status moves from queued to running and then succeeded. It can also end as empty, failed or cancelled. If a run takes a while, that is normal.
Step 9 Read the results
When the run has succeeded, read its rows:
curl https://api.socialholmes.com/api/public/v1/runs/RUN_ID/results \
-H "Authorization: Bearer $SOCIALHOLMES_KEY"
Open Runs in the app. The run you just made is listed there, with its cost, like any other run.
Go further#
- The endpoint reference lists every platform and endpoint, its inputs and what it returns, with code samples in several languages.
- Connect Claude, Cursor or another AI assistant to the same account with the AI assistants (MCP) page. It uses the same key.
- Use Webhooks in the app to be told when a run finishes, instead of asking again and again.
Troubleshooting#
- 401 Unauthorized. The key is missing, mistyped or revoked. Send it as
Authorization: Bearer sh_.... - I lost my key. Create a new one, update your code, then Revoke the old one.
- The run stays queued. Wait and ask again. Slow runs are normal. Do not start it twice.
- The request is refused for credits. A run is held at its maximum cost first. Lower the
limitor top up on the Billing page.