How to enable File Uploads in Chatkit?

I have embedded ChatKit in a test website and the workflow (Q&A) is working great.

I’m now trying to enable file uploads but the moment i attach a file i get the error:

Browser dev tools > network tab i see

 {
  "error": {
    "message": "File uploads are disabled for this session.",
    "type": "invalid_request_error",
    "param": null,
    "code": "chatkit.file_upload_disabled"
  }
}

But I’m struggling to see any options / account settings to enable file uploads?

Any help will be appreciated.

Thank you

3 Likes

I am using AgentKit to migrate an agent I have in code but when I try to upload a file through the file browser of the preview I get the following error

Error:
Workflow failed: Invalid file data: 'input_data.input[0].content[0].file_data'. Expected a base64-encoded data URL with a valid file MIME type (e.g. 'data:text/plain;base64,SGVsbG8sIFdvcmxkIQ=='), but got unsupported MIME type 'text/csv'. Please see https://platform.openai.com/docs/assistants/tools/file-search#supported-files for supported file types..

Maybe is the same bug

When using this workflow in my Chatbot, it doesn’t allow file uploads but when testing with the builder preview tool, it allows file uploads and reads them as expected?

Can’t find anything official about this being supported/unsupported though.

1 Like

There’s a setting to allow file upload while creating the client secret. I’m on my phone currently but I found it in the API docs.

I can upload with the core files endpoint

https://api.openai.com/v1/files

but i am unable to do so with the chatkit endpoint

https://api.openai.com/v1/chatkit/files

in Postman i also get this when passing my session ID

{
    "error": {
        "message": "File uploads are disabled for this session.",
        "type": "invalid_request_error",
        "param": null,
        "code": "chatkit.file_upload_disabled"
    }
}

Yeah I had the same issue unfortunately. Would be nice if someone from OpenAI gave a little help

@JDobbsy1987 I was having the same issue. The ChatKit session needs to be initialized server side with chatkit_configuration.file_upload.enabled set to true.

https://platform.openai.com/docs/api-reference/chatkit/sessions/create#chatkit-sessions-create-chatkit_configuration-file_upload-enabled

3 Likes

That did the trick!

Thank you so much!

Regards,
Jamie

Hi everyone,
For me, I’m now able to upload images and PDFs without any issue, but .xlsx and .csv files are still being rejected even after enabling file upload via the chatkit sessions.

I get the following backend error:

{
  "error": {
    "message": "Uploaded file type is not allowed for this session.",
    "type": "invalid_request_error",
    "param": null,
    "code": "chatkit.file_upload_type_rejected"
  }
}

Code Interpreter is enabled in my agent workflow, and file uploads are enabled in the ChatKit session (file_upload: { enabled: true }).
It looks like the session or ChatKit backend is still enforcing a more restrictive MIME type policy for data files, even though the agent should be able to handle .csv and .xlsx via Code Interpreter.

Is anyone else having this issue?

2 Likes

Any idea how to fix this? I need to upload .xlsx files and .csv but it throws and error

1 Like