Saltar para o conteúdo principal

Este browser já não é suportado.

Atualize para o Microsoft Edge para tirar partido das mais recentes funcionalidades, atualizações de segurança e de suporte técnico.

Transferir Microsoft Edge Mais informações sobre o Internet Explorer e o Microsoft Edge
microsoft-foundry.rest.security.o-auth2-auth

Uploads

Cancel an upload

POST /openai/v1/uploads/{upload_id}/cancel

Cancels an upload by its identifier.

Parâmetros de caminho

upload_id string obrigatório

The ID of the Upload.

Respostas

The request has succeeded.

Corpo

Content-Type: application/json
id string obrigatório

The Upload unique identifier, which can be referenced in API endpoints.

created_at integer obrigatório

The Unix timestamp (in seconds) for when the Upload was created.

filename string obrigatório

The name of the file to be uploaded.

bytes integer obrigatório
purpose string obrigatório

The intended purpose of the file. Please refer here for acceptable values.

status enum obrigatório

The status of the Upload.

pendingcompletedcancelledexpired
expires_at integer obrigatório

The Unix timestamp (in seconds) for when the Upload will expire.

object enum

The object type, which is always "upload".

upload
file OpenAI.OpenAIFile | null

The ready File object after the Upload is completed.

id string obrigatório

The file identifier, which can be referenced in the API endpoints.

bytes integer | null obrigatório

The size of the file, in bytes. In a completed file upload response, this can be null when the file size is not yet available.

created_at integer obrigatório

The Unix timestamp (in seconds) for when the file was created.

expires_at integer

The Unix timestamp (in seconds) for when the file will expire. In a completed file upload response, this can be null when no expiry is set.

filename string obrigatório

The name of the file.

object enum obrigatório

The object type, which is always file.

file
purpose enum obrigatório

The intended purpose of the file. Supported values are assistants, assistants_output, batch, batch_output, fine-tune, fine-tune-results, vision, and user_data.

assistantsassistants_outputbatchbatch_outputfine-tunefine-tune-resultsvisionuser_data
status enum obrigatório

Deprecated. The current status of the file, which can be either uploaded, processed, or error.

uploadedprocessederror
status_details string

Deprecated. For details on why a fine-tuning training file failed validation, see the error field on fine_tuning.job. Completed file upload responses can return null when these details are unset.

Client error

Corpo

Content-Type: application/json
error OpenAI.Error obrigatório
code string | null obrigatório
message string obrigatório
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
Qualquer uma das seguintes opções:
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 obrigatório

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

Server error

Corpo

Content-Type: application/json
error OpenAI.Error obrigatório
code string | null obrigatório
message string obrigatório
param string | null
type string
misalignment OpenAI.MisalignmentErrorDetailsResource
review_target string | null
error_type string | enum
Qualquer uma das seguintes opções:
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 obrigatório

The public continuation instruction.

details OpenAI.Error[]
additionalInfo object
debugInfo object

Pedir

curl https://api.openai.com/v1/uploads/upload_abc123/cancel
import OpenAI from 'openai';

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

const upload = await client.uploads.cancel('upload_abc123');

console.log(upload.id);
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
upload = client.uploads.cancel(
    "upload_abc123",
)
print(upload.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"),
    )
    upload, err := client.Uploads.Cancel(context.TODO(), "upload_abc123")
    if err != nil {
        panic(err.Error())
    }
    fmt.Printf("%+v
", upload.ID)
}
package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.uploads.Upload;
import com.openai.models.uploads.UploadCancelParams;

public final class Main {
    private Main() {}

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

        Upload upload = client.uploads().cancel("upload_abc123");
    }
}
require "openai"

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

upload = openai.uploads.cancel("upload_abc123")

puts(upload)

Response

{
  "id": "upload_abc123",
  "object": "upload",
  "bytes": 2147483648,
  "created_at": 1719184911,
  "filename": "training_examples.jsonl",
  "purpose": "fine-tune",
  "status": "cancelled",
  "expires_at": 1719127296
}
pt-pt
Suas opções de privacidade
  • Exclusão de responsabilidade de IA
  • Versões anteriores
  • Blogue
  • Contribuir
  • Privacidade
  • Privacidade da Saúde do Consumidor
  • Termos de Utilização
  • Marcas Comerciais
  • © Microsoft 2026