Mime Type / file extension for file inputs

Hi. I’m building an app using the Responses API where I need to pass files as input. We first upload the files using the Files API, with user_data purpose and the we reference them using file_id.

How relevant/important are the mime type and file extension for both APIs? I noticed that some extensions are rejected via the Files API (eg. .log). Also in the Responses API it seems to work sending a log file (.log, officially documented) even if the mime type is set as application/octet-stream (not mentioned as accepted)

Can the mime type be set to any value as long as the extension is accepted? Is the mime type relevant?

Hi exalog, thanks for sharing your use case.

In general, both the file extension and the MIME type should match the actual file contents.

For files used with the Responses API, it's recommended to upload them with purpose="user_data" and use a supported file extension along with the correct MIME type. For example, a .log file should typically use text/plain.

While application/octet-stream may work in some cases, it isn't documented as a supported MIME type for this use case, so it's better not to rely on it.

API Reference doc

Avinash