Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit is happening now. Discover what's next in customer experience.

GRM internal server error when trying to use JWT Auth and Adobe Analytics API


Level 1



I'm trying to connect to Adobe to run some prebaked queries on a schedule to return for my relational database.


When I code up my python script though, I keep getting a combination of errors depending on the time I run my script.  One time it can return this...

Error retrieving report data:
{"error_code":"500701", "message":"GRM internal server error"}


Other times it will return this; I am not making changes to my script between runs...

Error retrieving report data:
{"error_code":"403025", "message":"Profile is not valid"}



import sys
import csv
import json
import time
import requests
import jwt

# Set up your API credentials and report suite ID
client_id = 'helloWorld!'
client_secret = 'shhhhhhhhhhh'
technical_account_id = ''
org_id = 'thingsandstuff@AdobeOrg'
private_key = 'private.key'
report_suite_id = 'honeybadger'
json_query = 'marketing_channels.json'

# Set up the API endpoint and authentication URL
auth_url = ''
aud_url = f'{client_id}'
api_url = f'{report_suite_id}/reports'

# Load your private key
with open(private_key, 'r') as f:
    private_key_data =

# Set up the JWT payload
jwt_payload = {
    'iss': org_id,
    'sub': technical_account_id,
    'aud': '' + client_id,
    'exp': int(time.time()) + 300,
    'iat': int(time.time()),
    '': True,
    'meta_scopes': ['ent_analytics_bulk_ingest_sdk','read','write','','']

# Generate the JWT token
jwt_token = jwt.encode(jwt_payload, private_key_data, algorithm='RS256')

# Exchange the JWT token for an access token
auth_headers = {
    'Content-Type': 'application/x-www-form-urlencoded',
    'Cache-Control': 'no-cache'
auth_payload = {
    'client_id': client_id,
    'client_secret': client_secret,
    'jwt_token': jwt_token
auth_response =, headers=auth_headers, data=auth_payload)

if auth_response.status_code == 200:
    access_token = auth_response.json()['access_token']
    print("Access Token is: " + access_token)
    print('Error exchanging JWT token for access token:')

# Load your query JSON
with open(json_query, 'r') as f:
    query = json.load(f)

# Make the API call
headers = {
    'Authorization': f'Bearer {access_token}',
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'x-api-key': client_id,
    'x-proxy-global-company-id': org_id
response =, headers=headers, json=query)

# Process the response data
if response.status_code == 200:
    data = response.json()
    # Write data to CSV file
    with open('report_data.csv', 'w', newline='') as csvfile:
        writer = csv.writer(csvfile)
        # Write headers
        headers = [col['id'] for col in data['columns']]
        # Write rows
        for row in data['rows']:
    print('Data successfully written to report_data.csv')
    print('Error retrieving report data:')



Topics help categorize Community content and increase your ability to discover relevant content.

0 Replies

The ultimate experience is back.

Join us in Vegas to build skills, learn from the world's top brands, and be inspired.

Register Now