SocialHolmes Docs
Create account

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.

10 min to complete Guide 6 of 6

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.

The API keys page with the New key box and an empty keys table
The API keys page.

Step 2 Name the key and create it

Type a name in Name. Use the service that will use the key, for example Production or Reporting script. Click Create key.

The New key box with the name Production typed in
Name the key after what will use it.

Step 3 Copy the key now

A box appears at the top of the page: Copy this now — it is not shown again. Your key starts with sh_. Click Copy and save it somewhere safe, such as a password manager or your secret store.

The key shown once, with a Copy button (the key is blurred)
The key is shown once. The key in this picture is hidden.

Step 4 Check the key in the table

The new key appears in the table with its Name, a masked Key, Created, Last used and Requests. To stop a key from working, click Revoke. Anything using it then gets a 401 error.

The keys table with two keys, Docs demo and Production, each with a masked key and a Revoke button
Your keys.

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.

Shell
export SOCIALHOLMES_KEY="sh_your_key_here"

Step 6 Check your balance

This call is free. It also proves your key works.

cURL
curl https://api.socialholmes.com/api/public/v1/account/balance \
  -H "Authorization: Bearer $SOCIALHOLMES_KEY"

You should get back JSON with your available credits. A 401 means the key is wrong or revoked.

A terminal running the balance curl command and printing JSON
The balance call in a terminal.

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
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.

A terminal showing the 202 response with a run id and status queued
The run is accepted and queued.

Step 8 Check the run

Runs are asynchronous. Replace RUN_ID with your id and ask again until the status is succeeded.

cURL
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
curl https://api.socialholmes.com/api/public/v1/runs/RUN_ID/results \
  -H "Authorization: Bearer $SOCIALHOLMES_KEY"
A terminal showing the results JSON for natgeo
The results of the run.

Open Runs in the app. The run you just made is listed there, with its cost, like any other run.

The Runs page with the API run for natgeo at the top
API runs show up in the app.

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 limit or top up on the Billing page.

Next steps#