Skip to main content

Files

List files

Files this workspace uploaded, newest first, one page at a time.

gethttps://api.pre.dev/v1/filesTry it
curl -X GET "https://api.pre.dev/v1/files"
fetch("https://api.pre.dev/v1/files", {  method: "GET"})
package mainimport (  "fmt"  "net/http"  "io/ioutil")func main() {  url := "https://api.pre.dev/v1/files"  req, _ := http.NewRequest("GET", 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"response = requests.request("GET", 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"))  .GET()  .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.GetAsync("https://api.pre.dev/v1/files");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";  let res = client    .get(url)    .send()    .await?    .text()    .await?;  println!("{}", res);  Ok(())}

{  "object": "list",  "data": [    {      "id": "file-8Kz3pQ",      "object": "file",      "bytes": 1024000,      "created_at": 1790500000,      "filename": "contract.pdf",      "purpose": "user_data"    }  ],  "first_id": "file-8Kz3pQ",  "last_id": "file-8Kz3pQ",  "has_more": false}

GET
/v1/files

Authorization

AuthorizationBearer <token>

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

In: header

Query Parameters

limit?integer

Files per page, 1 to 50.

Range1 <= value <= 50
Default20
order?string

desc for newest first, asc for oldest first.

Default"desc"

Value in

  • "desc"
  • "asc"
after?string

A file id from an earlier page, usually its last_id. It must be one of this workspace's files, or the call returns 404 not_found.

purpose?string

Only files with this purpose, for example user_data.

Response Body

application/json

One page of files.

TypeScript Definitions

Use the response body type in TypeScript.

One page of this workspace's files. To read the next page, pass last_id as after while has_more is true.

application/json

application/json

application/json

application/json

Was this page helpful?