Skip to content

add: fileObject purpose type #1531

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ghdcksgml1
Copy link

  • I understand that this repository is auto-generated and my pull request may not be merged

Changes being requested

Fixed missing user_data purpose type in the FileObject interface to match the official OpenAI API specification.

Changes:

  • Added 'user_data' to the union type definition for the purpose field
  • Updated JSDoc comment to include user_data in the supported values list

Additional context & links

According to the OpenAI Files API documentation, user_data is a valid purpose value that can be used when uploading files. However, this option was missing from the TypeScript interface definition, causing a mismatch between the actual API capabilities and the type definitions.

The user_data purpose is commonly used for general file uploads (as seen in OpenAI's web dashboard) and is referenced in community discussions about file purposes, but was inadvertently omitted from this generated interface.

Example

curl https://api.openai.com/v1/files \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -F purpose="user_data" \
  -F file="@my.pdf"
// response
{
  "id": "file-abc123",
  "object": "file",
  "bytes": 120000,
  "created_at": 1677610602,
  "filename": "my.pdf",
  "purpose": "user_data",
}

@ghdcksgml1 ghdcksgml1 requested a review from a team as a code owner June 5, 2025 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant