Přeskočit na hlavní obsah

Tento prohlížeč se už nepodporuje.

Upgradujte na Microsoft Edge, abyste mohli využívat nejnovější funkce, aktualizace zabezpečení a technickou podporu.

Stáhnout Microsoft Edge Další informace o Internet Exploreru a Microsoft Edgi
microsoft-foundry.rest.security.o-auth2-auth

Files

Delete a file

DELETE /openai/v1/files/{file_id}

Deletes a file by its identifier.

Parametry cesty

file_id string vyžadováno

The ID of the file to use for this request.

Odpovědi

The request has succeeded.

Text

Content-Type: application/json
id string vyžadováno
object enum vyžadováno
file
deleted boolean vyžadováno

Client error

Text

Content-Type: application/json
error OpenAI.Error vyžadováno
code string | null vyžadováno
message string vyžadováno
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
Některá z následujících možností:
string
enum
potentially_unintended_data_transferpotentially_unintended_data_accesspotentially_unintended_destructive_activityother
detailed_explanation string

The public explanation for this block.

steer OpenAI._MisalignmentSteer
message string vyžadováno

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

Server error

Text

Content-Type: application/json
error OpenAI.Error vyžadováno
code string | null vyžadováno
message string vyžadováno
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
Některá z následujících možností:
string
enum
potentially_unintended_data_transferpotentially_unintended_data_accesspotentially_unintended_destructive_activityother
detailed_explanation string

The public explanation for this block.

steer OpenAI._MisalignmentSteer
message string vyžadováno

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

Žádost

curl https://api.openai.com/v1/files/file-abc123 \
  -X DELETE \
  -H "Authorization: Bearer $OPENAI_API_KEY"
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
file_deleted = client.files.delete(
    "file_id",
)
print(file_deleted.id)
import OpenAI from "openai";

const openai = new OpenAI();

async function main() {
  const file = await openai.files.delete("file-abc123");

  console.log(file);
}

main();
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const fileDeleted = await client.files.delete('file_id');

console.log(fileDeleted.id);
package main

import (
    "context"
    "fmt"

    "github.com/openai/openai-go"
    "github.com/openai/openai-go/option"
)

func main() {
    client := openai.NewClient(
        option.WithAPIKey("My API Key"),
    )
    fileDeleted, err := client.Files.Delete(context.TODO(), "file_id")
    if err != nil {
        panic(err.Error())
    }
    fmt.Printf("%+v
", fileDeleted.ID)
}
package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.files.FileDeleteParams;
import com.openai.models.files.FileDeleted;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        OpenAIClient client = OpenAIOkHttpClient.fromEnv();

        FileDeleted fileDeleted = client.files().delete("file_id");
    }
}
require "openai"

openai = OpenAI::Client.new(api_key: "My API Key")

file_deleted = openai.files.delete("file_id")

puts(file_deleted)

Response

{
  "id": "file-abc123",
  "object": "file",
  "deleted": true
}
cs-cz
Vaše volby ochrany osobních údajů
  • Právní omezení AI
  • Předchozí verze
  • Blog
  • Přispět
  • Ochrana osobních údajů
  • Ochrana osobních zdravotních údajů spotřebitelů
  • Podmínky použití
  • Ochranné známky
  • © Microsoft 2026