> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://respan.ai/docs/apis/gateway/list-files/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://respan.ai/_mcp/server. # List files GET https://api.respan.ai/api/files/ List files from the upstream OpenAI Files API using the authenticated organization key's OpenAI credentials. Reference: https://respan.ai/docs/apis/gateway/list-files ## Authentication - `Authorization` header (bearer token, required) — Use your Respan API key for Respan API authentication. Enter only the Respan API key value; clients send Authorization: Bearer \. 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. ## Request ### Query parameters - `provider_id` (string, required) — Provider route with customer-owned credentials, for example `openai` or `parasail`. ## Response ### 200 List of files. - `data` (list of ApiFilesGetResponsesContentApplicationJsonSchemaDataItems, required) - `object` (string, optional) ## Errors ### 400 Bad Request Error `provider_id` is missing. - `error` (ApiFilesGetResponsesContentApplicationJsonSchemaError, required) ### 401 Unauthorized Error 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. - `error` (ApiFilesGetResponsesContentApplicationJsonSchemaError, required) ### 403 Forbidden Error The API key is missing, invalid or expired. - `detail` (string, required) ## Types ### ApiFilesGetResponsesContentApplicationJsonSchemaDataItems - `id` (string, required) — File ID. - `object` (string, required) - `bytes` (integer, optional) — File size in bytes. - `created_at` (integer, optional) — Unix timestamp. - `filename` (string, optional) - `purpose` (string, optional) - `status` (string, optional) — File status. - `status_details` (any, optional, nullable) — Provider status details, when available. ### ApiFilesGetResponsesContentApplicationJsonSchemaError - `message` (string, required) - `type` (string, required) - `param` (any, optional, nullable) - `code` (any, optional, nullable) ## Examples **Response** ```json { "data": [ { "id": "file-abc123", "object": "file", "bytes": 12345, "created_at": 1710000000, "filename": "batch_input.jsonl", "purpose": "batch", "status": "processed", "status_details": null } ], "object": "list" } ``` **SDK Code** ```python import requests url = "https://api.respan.ai/api/files/" querystring = {"provider_id":"provider_id"} headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers, params=querystring) print(response.json()) ``` ```javascript const url = 'https://api.respan.ai/api/files/?provider_id=provider_id'; const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.respan.ai/api/files/?provider_id=provider_id" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.respan.ai/api/files/?provider_id=provider_id") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.respan.ai/api/files/?provider_id=provider_id") .header("Authorization", "Bearer ") .asString(); ``` ```php request('GET', 'https://api.respan.ai/api/files/?provider_id=provider_id', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.respan.ai/api/files/?provider_id=provider_id"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://api.respan.ai/api/files/?provider_id=provider_id")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```