GET
/
v1
/
datasets
/
files
/
{file_str}
/
download
/
using System;
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        string fileId = "YOUR_FILE_ID"; // Replace with your file ID
        string token = "YOUR_API_TOKEN"; // Replace with your API token
        string outputPath = "downloaded_file.pdf"; // Path where to save the downloaded file
        
        string url = $"https://api.roe-ai.com/v1/datasets/files/{fileId}/download/";
        
        using var client = new HttpClient();
        client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
        
        // Send the request
        HttpResponseMessage response = await client.GetAsync(url);
        
        if (response.IsSuccessStatusCode)
        {
            // For binary files, save the content to a file
            byte[] fileBytes = await response.Content.ReadAsByteArrayAsync();
            File.WriteAllBytes(outputPath, fileBytes);
            Console.WriteLine($"File downloaded successfully to {outputPath}");
            
            // If you want to read as text instead (for text files)
            // string responseBody = await response.Content.ReadAsStringAsync();
            // Console.WriteLine(responseBody);
        }
        else
        {
            Console.WriteLine($"Error: {response.StatusCode}");
            string errorContent = await response.Content.ReadAsStringAsync();
            Console.WriteLine(errorContent);
        }
    }
}
"Binary file content"

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

file_str
string
required

File string identifier (encoded file ID with optional metadata)

Query Parameters

page_range
string

Page range for PDF files (e.g., '1-5', '1,3,5', '1-3,5-7')

Response

200
application/json

File content

The response is of type file.