401: Invalid API Key when requesting job results #280

Open
opened 2026-02-16 00:17:21 -05:00 by yindo · 8 comments
Owner

Originally created by @mjcourte on GitHub (Sep 27, 2024).

Originally assigned to: @hexapode on GitHub.

Describe the bug
Write a concise description of what the bug is.

Bearer Token of <my llama cloud API key> does not allow me to download my job results.

Using a new account API key, I was able to parse a .pdf document, and retrieve it once (my first ever usage of LlamaParse). My script did not locally store the markdown, and while debugging downstream code, I need to recreate the objects md_json_list in example:

https://github.com/run-llama/llama_parse/blob/main/examples/multimodal/product_manual_rag.ipynb

md_json_objs = parser.get_json_result(files)
md_json_list = md_json_objs[0]["pages"]
image_dicts = parser.get_images(md_json_objs, download_path="data_images")

without hitting the API with another parse job, so I assume the right thing would be to API request download the markdown result.

LLAMA_CLOUD_TIMEOUT = 5
job_id = "f6b7a044-b820-4498-bfc8-f5917999d66f"
base_url = f"https://api.cloud.llamaindex.ai//api/v1/parsing/job/{job_id}"
payload = {}
headers = {
    "Accept": "application/json",
    "Authorization": f"Bearer {os.getenv('LLAMA_CLOUD_API_KEY')}",
}
print(headers)
result_json = requests.request(
    "GET", f"{base_url}/result/json", data=payload, timeout=LLAMA_CLOUD_TIMEOUT
)
if result_json.status_code == 401:
    print(f"Request status code {result_json.status_code}")
    sys.exit()

The result status is always 401, so I attempted the same in the web docs UI at:

https://docs.cloud.llamaindex.ai/API/get-job-json-result-api-v-1-parsing-job-job-id-result-json-get

Using the same llama cloud API key and job id.
(401)

{
  "detail": "Invalid API Key"
}

I created another LLama Cloud API key (both free tier, and I have credits remaining for the day), and it did not work either in python requests, or the web docs UI.

I can go to the job in my Parse tab at cloud.llamaindex.ai/parse, and export the items manually that way with no issue, but I will need this to work programmatically.

Files
If possible, please provide the PDF file causing the issue.

The only file sent was a NASA Nov 2006 style guide pdf, freely available online.

Job ID
If you have it, please provide the ID of the job you ran.
You can find it here: https://cloud.llamaindex.ai/parse in the "History" tab.

f6b7a044-b820-4498-bfc8-f5917999d66f

Screenshots
Feel free to also provide screenshots if relevant.

Client:
Please remove untested options:

  • Frontend (cloud.llamaindex.ai)
  • API

Options
What options did you use? Multimodal, fast mode, parsing instructions, etc.

parser = LlamaParse(
    result="markdown",
    parsing_instruction="You are given style guide documents",
    use_vendor_multimodal_model=True,
    vendor_multimodal_model_name="openai-gpt4o",
    show_progress=True,
    language="en",
)

Additional context
Add any additional context about the problem here.

Note that in the API reference documentation, the request headers contain the authorization bearer key twice. Probably unrelated.

https://docs.cloud.llamaindex.ai/API/get-job-json-result-api-v-1-parsing-job-job-id-result-json-get

import requests

url = "https://api.cloud.llamaindex.ai/api/v1/parsing/job/f6b7a044-b820-4498-bfc8-f5917999d66f/result/json"

payload={}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer <TOKEN>',
  'Authorization': 'Bearer <TOKEN>'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
Originally created by @mjcourte on GitHub (Sep 27, 2024). Originally assigned to: @hexapode on GitHub. **Describe the bug** Write a concise description of what the bug is. Bearer Token of \<my llama cloud API key\> does not allow me to download my job results. Using a new account API key, I was able to parse a .pdf document, and retrieve it once (my first ever usage of LlamaParse). My script did not locally store the markdown, and while debugging downstream code, I need to recreate the objects `md_json_list` in example: https://github.com/run-llama/llama_parse/blob/main/examples/multimodal/product_manual_rag.ipynb ```python md_json_objs = parser.get_json_result(files) md_json_list = md_json_objs[0]["pages"] image_dicts = parser.get_images(md_json_objs, download_path="data_images") ``` without hitting the API with another parse job, so I assume the right thing would be to API request download the markdown result. ```python LLAMA_CLOUD_TIMEOUT = 5 job_id = "f6b7a044-b820-4498-bfc8-f5917999d66f" base_url = f"https://api.cloud.llamaindex.ai//api/v1/parsing/job/{job_id}" payload = {} headers = { "Accept": "application/json", "Authorization": f"Bearer {os.getenv('LLAMA_CLOUD_API_KEY')}", } print(headers) result_json = requests.request( "GET", f"{base_url}/result/json", data=payload, timeout=LLAMA_CLOUD_TIMEOUT ) if result_json.status_code == 401: print(f"Request status code {result_json.status_code}") sys.exit() ``` The result status is always 401, so I attempted the same in the web docs UI at: https://docs.cloud.llamaindex.ai/API/get-job-json-result-api-v-1-parsing-job-job-id-result-json-get Using the same llama cloud API key and job id. (401) ``` { "detail": "Invalid API Key" } ``` I created another LLama Cloud API key (both free tier, and I have credits remaining for the day), and it did not work either in python requests, or the web docs UI. I can go to the job in my Parse tab at cloud.llamaindex.ai/parse, and export the items manually that way with no issue, but I will need this to work programmatically. **Files** If possible, please provide the PDF file causing the issue. The only file sent was a NASA Nov 2006 style guide pdf, freely available online. **Job ID** If you have it, please provide the ID of the job you ran. You can find it here: https://cloud.llamaindex.ai/parse in the "History" tab. f6b7a044-b820-4498-bfc8-f5917999d66f **Screenshots** Feel free to also provide screenshots if relevant. **Client:** Please remove untested options: - Frontend (cloud.llamaindex.ai) - API **Options** What options did you use? Multimodal, fast mode, parsing instructions, etc. ```python parser = LlamaParse( result="markdown", parsing_instruction="You are given style guide documents", use_vendor_multimodal_model=True, vendor_multimodal_model_name="openai-gpt4o", show_progress=True, language="en", ) ``` **Additional context** Add any additional context about the problem here. Note that in the API reference documentation, the request headers contain the authorization bearer key twice. Probably unrelated. https://docs.cloud.llamaindex.ai/API/get-job-json-result-api-v-1-parsing-job-job-id-result-json-get ```python import requests url = "https://api.cloud.llamaindex.ai/api/v1/parsing/job/f6b7a044-b820-4498-bfc8-f5917999d66f/result/json" payload={} headers = { 'Accept': 'application/json', 'Authorization': 'Bearer <TOKEN>', 'Authorization': 'Bearer <TOKEN>' } response = requests.request("GET", url, headers=headers, data=payload) print(response.text) ```
yindo added the bug label 2026-02-16 00:17:21 -05:00
Author
Owner

@mosoai commented on GitHub (Oct 7, 2024):

Hi,
I'm experiencing the same issue.
My observation is that the API key is not being persisted. Although it's displayed in the popup during generation, but the column where the key should be shown (I guess with stars ***) remains empty.

@mosoai commented on GitHub (Oct 7, 2024): Hi, I'm experiencing the same issue. My observation is that the API key is not being persisted. Although it's displayed in the popup during generation, but the column where the key should be shown (I guess with stars ***) remains empty.
Author
Owner

@marcosallustio commented on GitHub (Oct 31, 2024):

I have the same issue when I try to call API (for example on n8n) but with the tool of Parse in LlamaCloud the parsing is carried out

@marcosallustio commented on GitHub (Oct 31, 2024): I have the same issue when I try to call API (for example on n8n) but with the tool of Parse in LlamaCloud the parsing is carried out
Author
Owner

@rodamora commented on GitHub (Nov 19, 2024):

I am having the same problem. I can create a job with the API but cannot get the results. Getting a 401 Unauthorized response.

How can we fix this?

@rodamora commented on GitHub (Nov 19, 2024): I am having the same problem. I can create a job with the API but cannot get the results. Getting a 401 Unauthorized response. How can we fix this?
Author
Owner

@andyl25 commented on GitHub (Nov 22, 2024):

Any update? I'm having this issue too

@andyl25 commented on GitHub (Nov 22, 2024): Any update? I'm having this issue too
Author
Owner

@fpasare commented on GitHub (Jan 9, 2025):

Same issue here.

@fpasare commented on GitHub (Jan 9, 2025): Same issue here.
Author
Owner

@durga811 commented on GitHub (Feb 11, 2025):

i am also getting same issue , not able to get result

@durga811 commented on GitHub (Feb 11, 2025): i am also getting same issue , not able to get result
Author
Owner

@iMiroslav commented on GitHub (May 19, 2025):

same issue

@iMiroslav commented on GitHub (May 19, 2025): same issue
Author
Owner

@DHIMANvivek commented on GitHub (Aug 29, 2025):

it charged me more then 1 credits but for multi vendor you have byok and i am using my own api key using claude 3.5 but still charged me 3 credits per page.

here is the parameters that i used

{
"parse_mode": "parse_page_with_lvm",
"use_vendor_multimodal_model": true,
"vendor_multimodal_model_name": "anthropic-sonnet-3.5",
"vendor_multimodal_api_key": "sk-ant-********"
}

hide key for security purpose and my key is having credits.

@DHIMANvivek commented on GitHub (Aug 29, 2025): it charged me more then 1 credits but for multi vendor you have byok and i am using my own api key using claude 3.5 but still charged me 3 credits per page. here is the parameters that i used { "parse_mode": "parse_page_with_lvm", "use_vendor_multimodal_model": true, "vendor_multimodal_model_name": "anthropic-sonnet-3.5", "vendor_multimodal_api_key": "sk-ant-********" } hide key for security purpose and my key is having credits.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: run-llama/llama_cloud_services#280