How to properly authenticate with langsmith API run endpoint

I just set up my langsmith account and got my API key from the dashboard. I’m trying to make a simple POST request to test the runs API but keep getting an unauthorized error response.

Here’s what I’m trying:

wget --post-data='{"name":"My Test Run","run_type":"chain"}' \
     --header="Authorization: Bearer your_api_key_here" \
     --header="Content-Type: application/json" \
     https://api.smith.langchain.com/runs

I double checked my API key and it looks correct. Are there any additional authentication steps I’m missing? Maybe some account verification or permissions that need to be enabled first?

Been there. Usually it’s not the auth header - it’s the payload structure that gets you.

You need a session_id in your request body. Langsmith won’t accept runs without it:

wget --post-data='{"name":"My Test Run","run_type":"chain","session_id":"test-session-123"}' \
     --header="X-API-Key: your_api_key_here" \
     --header="Content-Type: application/json" \
     https://api.smith.langchain.com/runs

Also check you’re using the right project. If you created a custom project in your dashboard, you might need to specify it in the URL or headers.

Hit this exact issue building our monitoring pipeline. Wasted tons of time thinking it was auth when I just missed required fields. The error messages suck too.

Langsmith’s API key scope settings tripped me up when I first started. Even with the right X-API-Key header, you’ll get permission errors if your key has restricted scopes. Check your dashboard - is your API key set to full access or just read-only? I made three different keys before figuring out the first two were scoped wrong. Try a simple GET request to a read endpoint first to see if it’s auth vs write permissions. The runs endpoint needs write access since you’re creating new records. Also, make sure you’ve finished any onboarding steps - some enterprise features stay locked until verification’s done.

check your endpoint url first - regional differences and versioning can mess things up. also verify your account isn’t stuck in trial mode since some features get locked until you confirm your email or upgrade. i hit the same auth errors too.

Had this same issue setting up automated testing for our API integrations. It’s usually the header format or endpoint that’s wrong.

Try X-API-Key instead of Authorization: Bearer. Langsmith uses different auth headers:

wget --post-data='{"name":"My Test Run","run_type":"chain"}' \
     --header="X-API-Key: your_api_key_here" \
     --header="Content-Type: application/json" \
     https://api.smith.langchain.com/runs

Double-check you didn’t copy extra spaces or characters from the dashboard when grabbing your API key.

Manual API auth gets old fast though. I automated all our Langsmith stuff with Latenode - it handles auth automatically. Set up the API key once in secure storage, then build workflows that create runs, fetch data, and trigger actions based on results.

The visual builder makes connecting Langsmith to other tools way easier than writing curl commands or debugging headers.

The authorization header looks wrong. Langchain APIs don’t use standard Bearer tokens - they want X-API-Key with your key value instead of Authorization: Bearer. Double-check you’re hitting the right base URL too. I’ve seen the API endpoint change based on account region or tier. Also verify your API key has write permissions. Some keys are read-only by default and you need to enable write access in your account settings. Check the network tab when you use the dashboard - see what headers it actually sends.