File column access

https://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name/tables/table_name/data/record_id/column/column_name/file

File access endpoint allows upload and download of binary file content.

Expected parameters

NameDescriptionInRequiredSchema
db_branch_name

The DBBranchName matches the pattern {db_name}:{branch_name}.

path✅string
table_name

The Table name

path✅string
record_id

The Record name

path✅string
column_name

The Column name

path✅string

Download Content From a File Column

GET
https://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name/tables/table_name/data/record_id/column/column_name/file

Retrieves the file content from a file column

Responses

type GetFile = void;

Upload Content to a File Column

PUT
https://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name/tables/table_name/data/record_id/column/column_name/file

Uploads the file content to the given file column

Request Body Type Definition

/**
 * @format binary
 */
type PutFile = Blob;

Responses

/**
 * File metadata
 */
type PutFile = {
    id?: FileItemID;
    name: FileName;
    mediaType: MediaType;
    /**
     * @format int64
     */
    size: number;
    /**
     * @format int64
     */
    version: number;
    attributes?: Record<string, any>;
};
 
/**
 * Unique file identifier
 * 
 * @maxLength 255
 * @minLength 1
 * @pattern [a-zA-Z0-9_-~:]+
 */
type FileItemID = string;
 
/**
 * File name
 * 
 * @maxLength 1024
 * @minLength 0
 * @pattern [0-9a-zA-Z!\-_\.\*'\(\)]*
 */
type FileName = string;
 
/**
 * Media type
 * 
 * @maxLength 255
 * @minLength 3
 * @pattern ^\w+/[-+.\w]+$
 */
type MediaType = string;
 
/**
 * Xata Table Record Metadata
 */
type Record = RecordMeta & {
    [key: string]: any;
};
 
/**
 * Xata Table Record Metadata
 */
type RecordMeta = {
    id: RecordID;
    xata: {
        /**
         * The record's version. Can be used for optimistic concurrency control.
         */
        version: number;
        /**
         * The time when the record was created.
         */
        createdAt?: string;
        /**
         * The time when the record was last updated.
         */
        updatedAt?: string;
        /**
         * The record's table name. APIs that return records from multiple tables will set this field accordingly.
         */
        table?: string;
        /**
         * Highlights of the record. This is used by the search APIs to indicate which fields and parts of the fields have matched the search.
         */
        highlight?: {
            [key: string]: string[] | {
                [key: string]: any;
            };
        };
        /**
         * The record's relevancy score. This is returned by the search APIs.
         */
        score?: number;
        /**
         * Encoding/Decoding errors
         */
        warnings?: string[];
    };
};
 
/**
 * @maxLength 255
 * @minLength 1
 * @pattern [a-zA-Z0-9_-~:]+
 */
type RecordID = string;

Remove the Content From a File Column

DELETE
https://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name/tables/table_name/data/record_id/column/column_name/file

Deletes a file referred in a file column

Responses

/**
 * File metadata
 */
type DeleteFile = {
    id?: FileItemID;
    name: FileName;
    mediaType: MediaType;
    /**
     * @format int64
     */
    size: number;
    /**
     * @format int64
     */
    version: number;
    attributes?: Record<string, any>;
};
 
/**
 * Unique file identifier
 * 
 * @maxLength 255
 * @minLength 1
 * @pattern [a-zA-Z0-9_-~:]+
 */
type FileItemID = string;
 
/**
 * File name
 * 
 * @maxLength 1024
 * @minLength 0
 * @pattern [0-9a-zA-Z!\-_\.\*'\(\)]*
 */
type FileName = string;
 
/**
 * Media type
 * 
 * @maxLength 255
 * @minLength 3
 * @pattern ^\w+/[-+.\w]+$
 */
type MediaType = string;
 
/**
 * Xata Table Record Metadata
 */
type Record = RecordMeta & {
    [key: string]: any;
};
 
/**
 * Xata Table Record Metadata
 */
type RecordMeta = {
    id: RecordID;
    xata: {
        /**
         * The record's version. Can be used for optimistic concurrency control.
         */
        version: number;
        /**
         * The time when the record was created.
         */
        createdAt?: string;
        /**
         * The time when the record was last updated.
         */
        updatedAt?: string;
        /**
         * The record's table name. APIs that return records from multiple tables will set this field accordingly.
         */
        table?: string;
        /**
         * Highlights of the record. This is used by the search APIs to indicate which fields and parts of the fields have matched the search.
         */
        highlight?: {
            [key: string]: string[] | {
                [key: string]: any;
            };
        };
        /**
         * The record's relevancy score. This is returned by the search APIs.
         */
        score?: number;
        /**
         * Encoding/Decoding errors
         */
        warnings?: string[];
    };
};
 
/**
 * @maxLength 255
 * @minLength 1
 * @pattern [a-zA-Z0-9_-~:]+
 */
type RecordID = string;