Delete File Api enpoint is incorrect at Documentation

Documentation says delete file endpoint is "DELETE https://api.openai.com/v1/files/{file_id}/content" but I think “/content” part is not correct.

Initially, I followed the documentation and I got this error: 405 Not allowed to DELETE on /v1/files/file-XXXX/content. (HINT: Perhaps you meant to use a different HTTP method?)
Then I tried DELETE /v1/files/{file_id} and it worked as expected.

Updating documentation could save someone else time :slight_smile:

1 Like

Thanks, noted - we’ll update soon!

1 Like

Thanks, I have 1 more question and 1 feedback about documentation. Should I post here as a reply or should I open a new topic?

Up to you, depending on how related it is. If you end up opening a new topic please ping me :slight_smile:

1 Like

@boris

Documentation Sample python code error

import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
openai.File("file-XjGxS3KTG0uNmNOK362iJua3").delete()

I get

TypeError: delete() missing 1 required positional argument: 'sid'

I am trying to delete all but one file.

2 Likes

Oh dang, I’ve seen that error before with a different API endpoint. ‘SID’ is short for security identifier ( SID ) is used to uniquely identify a security principal or security group in Windows. Not sure if that is for internal use or not though.

I’ll remind myself to send a support email tonight regarding the different API endpoint I noticed that error on too.

1 Like

Does it work as a result cURL request?

cURL did the job for me.