Skip to Content

Delete a file

DELETEhttps://api.respan.ai/api/files/{file_id}/

Delete a file from the upstream OpenAI Files API.

Servers

https://api.respan.ai: Respan API Server

Authentication

RespanApiKey

Use your Respan API key for Respan API authentication. Enter only the Respan API key value; clients send Authorization: Bearer <RESPAN_API_KEY>. For /api/responses, provider credentials such as Perplexity, OpenAI, or Azure OpenAI go in Settings -> Providers or respan_params.credential_override in the request body, not in this authentication field.

HTTP scheme: bearer; format: Respan API key.

HTTP
Authorization: Bearer $RESPAN_API_KEY

Path parameters

Parameter Type Required Description and constraints
file_id string Required
OpenAI file ID.
Example: "file-abc123"

Query parameters

Parameter Type Required Description and constraints
provider_id string Required
Provider route with customer-owned credentials, for example openai or parasail.

Responses

200

Deleted file.

application/json

Field Type Requirement Description and constraints
$ object Body
-
id string Required in parent
Example: "file-abc123"
object string Optional
Example: "file"
deleted boolean Required in parent
Example: true

OpenAPI response schema

{
  "type": "object",
  "required": [
    "id",
    "deleted"
  ],
  "properties": {
    "id": {
      "type": "string",
      "example": "file-abc123"
    },
    "object": {
      "type": "string",
      "example": "file"
    },
    "deleted": {
      "type": "boolean",
      "example": true
    }
  }
}

401

You haven’t added your own key for the provider in Settings › Providers, or the provider rejected it. Files and batches always run on your own key; Respan credits can’t cover them.

application/json

Field Type Requirement Description and constraints
$ object Body
-
error object Required in parent
-
error.message string Required in parent
-
error.type string Required in parent
-
error.param any or null Optional
-
error.code any or null Optional
-

OpenAPI response schema

{
  "type": "object",
  "required": [
    "error"
  ],
  "properties": {
    "error": {
      "type": "object",
      "required": [
        "message",
        "type"
      ],
      "properties": {
        "message": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "param": {
          "nullable": true
        },
        "code": {
          "nullable": true
        }
      }
    }
  }
}
Example
JSON
{ "error": { "message": "Please add your OpenAI API key in Settings -> Providers. The Files and Batch endpoints always run on your own credentials. Respan credits cannot cover them, because a batch's usage is only known after it completes.", "type": "upstream_provider_error", "param": null, "code": null } }

403

The API key is missing, invalid or expired.

application/json

Field Type Requirement Description and constraints
$ object Body
-
detail string Required in parent
-

OpenAPI response schema

{
  "type": "object",
  "required": [
    "detail"
  ],
  "properties": {
    "detail": {
      "type": "string"
    }
  }
}
Example
JSON
{ "detail": "Your API key is invalid or expired, please check your API key in the platform settings." }

404

Not Found

application/json

Field Type Requirement Description and constraints
$ object Body
Additional properties are allowed
error string Optional
-
detail string Optional
-
error_class string Optional
-
id string Optional
-

OpenAPI response schema

{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "detail": {
      "type": "string"
    },
    "error_class": {
      "type": "string"
    },
    "id": {
      "type": "string"
    }
  },
  "additionalProperties": true
}
Example
JSON
{ "error": "Not found" }

OpenAPI source

The operation and referenced components below retain the complete OpenAPI definitions, including constraints and examples.

OpenAPI operation

{
  "summary": "Delete a file",
  "operationId": "deleteFile",
  "tags": [
    "OpenAI Batch"
  ],
  "description": "Delete a file from the upstream OpenAI Files API.",
  "parameters": [
    {
      "name": "file_id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      },
      "description": "OpenAI file ID.",
      "example": "file-abc123"
    },
    {
      "name": "provider_id",
      "in": "query",
      "required": true,
      "schema": {
        "type": "string"
      },
      "description": "Provider route with customer-owned credentials, for example `openai` or `parasail`."
    }
  ],
  "responses": {
    "200": {
      "description": "Deleted file.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "id",
              "deleted"
            ],
            "properties": {
              "id": {
                "type": "string",
                "example": "file-abc123"
              },
              "object": {
                "type": "string",
                "example": "file"
              },
              "deleted": {
                "type": "boolean",
                "example": true
              }
            }
          }
        }
      }
    },
    "401": {
      "description": "You haven't added your own key for the provider in Settings › Providers, or the provider rejected it. Files and batches always run on your own key; Respan credits can't cover them.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "error"
            ],
            "properties": {
              "error": {
                "type": "object",
                "required": [
                  "message",
                  "type"
                ],
                "properties": {
                  "message": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string"
                  },
                  "param": {
                    "nullable": true
                  },
                  "code": {
                    "nullable": true
                  }
                }
              }
            }
          },
          "example": {
            "error": {
              "message": "Please add your OpenAI API key in Settings -> Providers. The Files and Batch endpoints always run on your own credentials. Respan credits cannot cover them, because a batch's usage is only known after it completes.",
              "type": "upstream_provider_error",
              "param": null,
              "code": null
            }
          }
        }
      }
    },
    "403": {
      "$ref": "#/components/responses/InvalidApiKey"
    },
    "404": {
      "description": "Not Found",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string"
              },
              "detail": {
                "type": "string"
              },
              "error_class": {
                "type": "string"
              },
              "id": {
                "type": "string"
              }
            },
            "additionalProperties": true
          },
          "example": {
            "error": "Not found"
          }
        }
      }
    }
  },
  "security": [
    {
      "RespanApiKey": []
    }
  ]
}

OpenAPI path metadata

{}

Referenced OpenAPI components

{
  "responses": {
    "InvalidApiKey": {
      "description": "The API key is missing, invalid or expired.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "detail"
            ],
            "properties": {
              "detail": {
                "type": "string"
              }
            }
          },
          "example": {
            "detail": "Your API key is invalid or expired, please check your API key in the platform settings."
          }
        }
      }
    }
  },
  "securitySchemes": {
    "RespanApiKey": {
      "type": "http",
      "scheme": "bearer",
      "bearerFormat": "Respan API key",
      "description": "Use your Respan API key for Respan API authentication. Enter only the Respan API key value; clients send Authorization: Bearer <RESPAN_API_KEY>. For /api/responses, provider credentials such as Perplexity, OpenAI, or Azure OpenAI go in Settings -> Providers or respan_params.credential_override in the request body, not in this authentication field.",
      "x-fern-bearer": {
        "name": "respanApiKey",
        "env": "RESPAN_API_KEY"
      }
    }
  }
}