Skip to main content
The Benzinga API uses API Keys to authenticate requests. Your API Key is a unique identifier that grants access to specific data and features based on your subscription.
Keep your API Key secure. Do not share it in publicly accessible areas such as GitHub, client-side code, or unsecured communications. If you believe your key has been compromised, contact support immediately.
You can view and manage your API Key in your Benzinga Developer Console.

Authentication Methods

The Benzinga API supports two methods for authentication. We strongly recommend using the HTTP Header method for production applications as it is more secure and prevents your key from appearing in URL logs.

Query Parameter

For quick testing or when header modification isn’t possible, you can pass your key as a query parameter named token.
https://api.benzinga.com/api/v2/news?token=<YOUR_API_KEY>

Code Examples

Here are production-ready examples for connecting to the Benzinga API in common languages.
# Alternative: Query Parameter
curl -L 'https://api.benzinga.com/api/v2/news?pageSize=1&token=YOUR_API_KEY'
import requests

url = "https://api.benzinga.com/api/v2/news"

# Recommended: Header Authentication
headers = {
    "Authorization": "token YOUR_API_KEY",
    "Accept": "application/json"
}

params = {
	"token": YOUR_API_KEY
    "pageSize": 1
}

try:
    response = requests.get(url, headers=headers, params=params)
    response.raise_for_status() # Raise detailed error for 4xx/5xx responses
    data = response.json()
    print(data)
except requests.exceptions.RequestException as e:
    print(f"Error fetching data: {e}")
const axios = require('axios');

const url = 'https://api.benzinga.com/api/v2/news?token=YOUR_API_KEY';
const apiKey = 'YOUR_API_KEY';

async function getNews() {
  try {
    const response = await axios.get(url, {
      headers: {
        'Accept': 'application/json'
      },
      params: {
        pageSize: 1
      }
    });
    
    console.log(response.data);
  } catch (error) {
    if (error.response) {
      // The request was made and the server responded with a status code
      // that falls out of the range of 2xx
      console.error('Error Status:', error.response.status);
      console.error('Error Data:', error.response.data);
    } else {
      console.error('Error Message:', error.message);
    }
  }
}

getNews();
package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
)

func main() {
	url := "https://api.benzinga.com/api/v2/news?pageSize=1&apiKey=YOUR_API_KEY"

	req, err := http.NewRequest("GET", url, nil)
	if err != nil {
		panic(err)
	}

	req.Header.Add("Accept", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	if resp.StatusCode >= 400 {
		fmt.Printf("Error: Status Code %d\n", resp.StatusCode)
		return
	}

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		panic(err)
	}

	fmt.Println(string(body))
}

Troubleshooting

Common authentication errors and how to resolve them.
Status CodeMessagePossible CauseResolution
401UnauthorizedInvalid API KeyCheck that your API key is correct and has not been regenerated. ensure no extra spaces are copied.
401UnauthorizedMissing API KeyEnsure the Authorization header is formatted correctly as token <KEY> or the token parameter is present.
403ForbiddenInsufficient PermissionsYour API key is valid, but your plan does not include access to the requested endpoint. Contact sales or support to upgrade your plan.