Skip to main content
Question

Issue with Obtaining JSON Access Token Using API Key in Cribl

  • March 11, 2025
  • 3 replies
  • 36 views

Hi,

I'm working on code that uses an API key to access my data in Cribl. I started by creating API credentials (client_id and client_secret) and built a simple script to obtain an access token, which I plan to use for querying logs.

Here’s the code I wrote:
import requestsclient_id = 'XXX'
client_secret = 'XXX'
auth_url = 'https://XXX.cribl.cloud/api/v1/auth/token'
payload = {
'grant_type': 'client_credentials',
'client_id': client_id,
'client_secret': client_secret,
'audience': 'https://api.cribl.cloud'
}
headers = {
'Content-Type': 'application/json'
}response = requests.post(auth_url, data=payload, headers=headers)

When I run this, I receive a 200 response, but the content is not in JSON format. Instead, the content is:

you need to enable JavaScript to run this app.

It seems to be returning the web application HTML rather than a JSON response with an access token. My goal is to use this token in a query to fetch logs.

Could you please help me understand why the token request is returning HTML instead of JSON, and how to correctly obtain the access token?

Thank you!

3 replies

Jon Rust
Forum|alt.badge.img
  • Employee
  • 500 replies
  • March 11, 2025

You can see a sample of login process in

https://github.com/camrunr/cribl_update_secret/blob/main/cribl_update_secret.py

Hopefully it will help you get started.


  • Author
  • New Participant
  • 1 reply
  • March 11, 2025

Hi, @Jon Rust thank you!

I successfully built my access token and used it. Do you know if I can use it to retrieve logs from the data lake I created (the destination data)?

Also, does having a free account limit any of the available API functionalities?


rcalvert
  • Employee
  • 4 replies
  • September 11, 2025

There’s a section in the docs to cover Searching using the API here: https://docs.cribl.io/api/search-results/ 
I’m not sure about the free account limits.