Issue Uploading JSON File for Prompt Reference in Azure AI Foundry (415 Unsupported Media Type)

Samuel Unyime 0 Reputation points
2025-08-20T13:51:07.5166667+00:00

Hello Azure Support,

I am currently developing a project where I want to use AI to summarize reports. The expected workflow is:

  1. Upload a JSON file (around 23KB) containing the raw report.

Summarize the report via AI and store the result as JSON.

Run a prompt that references the uploaded file (instead of embedding the JSON directly in the prompt since it is too large).

Here is what I’ve done so far:

I have successfully deployed a model in Azure AI Foundry.

I tested it in the Playground — uploaded a file into a vector store and referenced it in my prompt, and it worked correctly.

I also built a simple application in JavaScript for chat completions, and that worked fine.

The problem arises when I try to upload the JSON file via JavaScript. I consistently get the error:

APIError: 415 Unsupported Media Type

Despite following the documentation here: https://learn.microsoft.com/en-us/azure/ai-foundry/quickstarts/get-started-code?tabs=javascript&pivots=fdp-project

I’ve tried multiple approaches but still encounter this issue when attempting the upload + prompt reference flow.

Could you please clarify the correct way to upload a JSON file via JavaScript and then reference it in a prompt? Any working example or guidance would be highly appreciated.

Thank you,Hello Azure Support,

I am currently developing a project where I want to use AI to summarize reports. The expected workflow is:

Upload a JSON file (around 23KB) containing the raw report.

Summarize the report via AI and store the result as JSON.

Run a prompt that references the uploaded file (instead of embedding the JSON directly in the prompt since it is too large).

Here is what I’ve done so far:

I have successfully deployed a model in Azure AI Foundry.

I tested it in the Playground — uploaded a file into a vector store and referenced it in my prompt, and it worked correctly.

I also built a simple application in JavaScript for chat completions, and that worked fine.

The problem arises when I try to upload the JSON file via JavaScript. I consistently get the error:

APIError:

Despite following the documentation here:
https://learn.microsoft.com/en-us/azure/ai-foundry/quickstarts/get-started-code?tabs=javascript&pivots=fdp-project

I’ve tried multiple approaches but still encounter this issue when attempting the upload + prompt reference flow.

Could you please clarify the correct way to upload a JSON file via JavaScript and then reference it in a prompt? Any working example or guidance would be highly appreciated.

Thank you,
Samuel Benny (Smith Kruz)

Azure AI Language
Azure AI Language
An Azure service that provides natural language capabilities including sentiment analysis, entity extraction, and automated question answering.
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.