{ "api_key": "<api_key>", "api_secret": "<api_secret>", "message": "API key created. Write down the secret – it's only shown once! If you need to access your secret again, contact Visual Layer support at support@visual-layer.com."}
You can also run this using curl:
Copy
Ask AI
curl -b SESSION=<session from authenticated user browser session> https://app.visual-layer.com/api/v1/api_credentials
Use your API key and secret to generate a JWT token, which is required for authenticated API requests.
JWT Token Authentication
JWTs must be included in the Authorization header as a Bearer token type on every request.
These tokens are short-lived and should be regenerated periodically.
You can test your JWT token by retrieving the status of one of your datasets:
Copy
Ask AI
# Replace <jwt_token> with your generated JWT token# Replace <dataset_id> with one of your dataset IDscurl -H "Authorization: Bearer <jwt_token>" \ https://app.visual-layer.com/api/v1/dataset/<dataset_id>
import requests# Your generated JWT tokenjwt_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."# One of your dataset IDs (you can find this in the URL when viewing a dataset)dataset_id = "your-dataset-id-here"# Make the API requesturl = f"https://app.visual-layer.com/api/v1/dataset/{dataset_id}"headers = {"Authorization": f"Bearer {jwt_token}"}response = requests.get(url, headers=headers)# Check the responseif response.status_code == 200: dataset_info = response.json() print(f"✓ Success! Dataset: {dataset_info['display_name']}") print(f" Status: {dataset_info['status']}") print(f" Progress: {dataset_info['progress']}%")elif response.status_code == 401: print("✗ Authentication failed - check your JWT token")elif response.status_code == 404: print("✗ Dataset not found - check your dataset ID")else: print(f"✗ Error: {response.status_code} - {response.text}")