Skip to main content

Files

Delete a file

Delete one of the workspace's files permanently.

delhttps://api.pre.dev/v1/files/{id}Try it
curl -X DELETE "https://api.pre.dev/v1/files/string"
fetch("https://api.pre.dev/v1/files/string", {  method: "DELETE"})
package mainimport (  "fmt"  "net/http"  "io/ioutil")func main() {  url := "https://api.pre.dev/v1/files/string"  req, _ := http.NewRequest("DELETE", url, nil)  res, _ := http.DefaultClient.Do(req)  defer res.Body.Close()  body, _ := ioutil.ReadAll(res.Body)  fmt.Println(res)  fmt.Println(string(body))}
import requestsurl = "https://api.pre.dev/v1/files/string"response = requests.request("DELETE", url)print(response.text)
import java.net.URI;import java.net.http.HttpClient;import java.net.http.HttpRequest;import java.net.http.HttpResponse;import java.net.http.HttpResponse.BodyHandlers;import java.time.Duration;HttpClient client = HttpClient.newBuilder()  .connectTimeout(Duration.ofSeconds(10))  .build();HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()  .uri(URI.create("https://api.pre.dev/v1/files/string"))  .DELETE()  .build();try {  HttpResponse<String> response = client.send(requestBuilder.build(), BodyHandlers.ofString());  System.out.println("Status code: " + response.statusCode());  System.out.println("Response body: " + response.body());} catch (Exception e) {  e.printStackTrace();}
using System;using System.Net.Http;using System.Text;var client = new HttpClient();var response = await client.DeleteAsync("https://api.pre.dev/v1/files/string");var responseBody = await response.Content.ReadAsStringAsync();
use reqwest::{Result, Client};async fn main() -> Result<()> {  let client = Client::new();  let url = "https://api.pre.dev/v1/files/string";  let res = client    .delete(url)    .send()    .await?    .text()    .await?;  println!("{}", res);  Ok(())}

{  "id": "file-8Kz3pQ",  "object": "file",  "deleted": true}

DELETE
/v1/files/{id}

Authorization

AuthorizationBearer <token>

The workspace API key (pdk_…) from Integrations → Built-in in the pre.dev dashboard.

In: header

Path Parameters

id*string

Response Body

application/json

The file was deleted.

TypeScript Definitions

Use the response body type in TypeScript.

Deletion result: { id, object: "file", deleted: true } in the OpenAI style, or { id, type: "file_deleted" }.

application/json

application/json

application/json

application/json

Was this page helpful?