> ## Documentation Index
> Fetch the complete documentation index at: https://flatfile.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Polyglot API

> choose your language

> [!WARNING]
>
> **Legacy Documentation** - This documentation is maintained for backward compatibility. For the latest API documentation, please visit our [current API reference](https://reference.flatfile.com/).

Our [API SDK](https://reference.flatfile.com/overview/welcome) is available in
multiple languages, making it easy to integrate Flatfile regardless of your tech
stack. Each library gives you the full power of our platform in patterns you'll
feel right at home with.

> **[Node](https://www.npmjs.com/package/@flatfile/api)**
>
> A JavaScript client for Flatfile.

> **[Go](https://github.com/FlatFilers/flatfile-go)**
>
> A Go client for Flatfile.

> **[Python](https://pypi.org/project/flatfile/)**
>
> A Python client for Flatfile.

> **[Java](https://github.com/FlatFilers/flatfile-java)**
>
> A Java client for Flatfile.
>
> Coming Soon.

### Setup

After installing the package, import the `FlatfileClient` and instantiate it by
passing in your secret key as the token.

```ts theme={null}
import { FlatfileClient } from "@flatfile/api";

const token = "sk_your_secret_key";
const api = new FlatfileClient({ token });
```

> [!WARNING]
>
> Make sure to keep your secret key safe, as it can be used to access
> potentially sensitive information.

### Making API Calls

Make API calls by calling the appropriate method on the `api` object. \
&#x20;Note
that responses are promises, so you'll need to handle them accordingly.

## Core API Methods

> **actions.create**
>
> ```ts theme={null}
> await api.actions.create({
>   spaceId: "us_sp_your_space_id",
>   workbookId: "us_wb_your_workbook_id",
>   actionConfig: { ... },
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/actions/create)

> **actions.get**
>
> ```ts theme={null}
> await api.actions.get({
>   actionId: "us_ac_your_action_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/actions/get)

> **actions.list**
>
> ```ts theme={null}
> await api.actions.list({
>   spaceId: "us_sp_your_space_id",
>   workbookId: "us_wb_your_workbook_id",
>   filter: { ... },
>   page: 1,
>   pageSize: 10
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/actions/get-all)

> **actions.cancel**
>
> ```ts theme={null}
> await api.actions.cancel({
>   actionId: "us_ac_your_action_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/actions/cancel)

> **actions.retry**
>
> ```ts theme={null}
> await api.actions.retry({
>   actionId: "us_ac_your_action_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/actions/retry)

> **agents.create**
>
> ```ts theme={null}
> await api.agents.create({
>   environmentId: "us_env_your_environment_id",
>   config: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/agents/create)

> **agents.get**
>
> ```ts theme={null}
> await api.agents.get({
>   agentId: "us_ag_your_agent_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/agents/get)

> **agents.update**
>
> ```ts theme={null}
> await api.agents.update({
>   agentId: "us_ag_your_agent_id",
>   config: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/agents/update)

> **agents.delete**
>
> ```ts theme={null}
> await api.agents.delete({
>   agentId: "us_ag_your_agent_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/agents/delete)

> **agents.list**
>
> ```ts theme={null}
> await api.agents.list({
>   environmentId: "us_env_your_environment_id",
>   filter: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/agents/get-all)

> **agents.deploy**
>
> ```ts theme={null}
> await api.agents.deploy({
>   agentId: "us_ag_your_agent_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/agents/deploy)

> **agents.logs**
>
> ```ts theme={null}
> await api.agents.logs({
>   agentId: "us_ag_your_agent_id",
>   filter: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/agents/logs)

> **documents.create**
>
> ```ts theme={null}
> await api.documents.create({
>   spaceId: "us_sp_your_space_id",
>   content: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/documents/create)

> **documents.get**
>
> ```ts theme={null}
> await api.documents.get({
>   documentId: "us_doc_your_document_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/documents/get)

> **documents.update**
>
> ```ts theme={null}
> await api.documents.update({
>   documentId: "us_doc_your_document_id",
>   content: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/documents/update)

> **documents.delete**
>
> ```ts theme={null}
> await api.documents.delete({
>   documentId: "us_doc_your_document_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/documents/delete)

> **documents.list**
>
> ```ts theme={null}
> await api.documents.list({
>   spaceId: "us_sp_your_space_id",
>   filter: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/documents/list)

> **documents.share**
>
> ```ts theme={null}
> await api.documents.share({
>   documentId: "us_doc_your_document_id",
>   recipients: ["user@example.com"]
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/documents/share)

> **environments.create**
>
> ```ts theme={null}
> await api.environments.create({
>   name: "Production",
>   config: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/environments/create)

> **environments.get**
>
> ```ts theme={null}
> await api.environments.get({
>   environmentId: "us_env_your_environment_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/environments/get)

> **environments.update**
>
> ```ts theme={null}
> await api.environments.update({
>   environmentId: "us_env_your_environment_id",
>   config: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/environments/update)

> **environments.delete**
>
> ```ts theme={null}
> await api.environments.delete({
>   environmentId: "us_env_your_environment_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/environments/delete)

> **environments.list**
>
> ```ts theme={null}
> await api.environments.list()
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/environments/get-all)

> **environments.getSecrets**
>
> ```ts theme={null}
> await api.environments.getSecrets({
>   environmentId: "us_env_your_environment_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/environments/get-secrets)

> **environments.updateSecrets**
>
> ```ts theme={null}
> await api.environments.updateSecrets({
>   environmentId: "us_env_your_environment_id",
>   secrets: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/environments/update-secrets)

> **files.upload**
>
> ```ts theme={null}
> await api.files.upload({
>   data: fileData,
>   config: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/files/upload)

> **files.download**
>
> ```ts theme={null}
> await api.files.download({
>   fileId: "us_fl_your_file_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/files/download)

> **files.get**
>
> ```ts theme={null}
> await api.files.get({
>   fileId: "us_fl_your_file_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/files/get)

> **files.delete**
>
> ```ts theme={null}
> await api.files.delete({
>   fileId: "us_fl_your_file_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/files/delete)

> **files.list**
>
> ```ts theme={null}
> await api.files.list({
>   filter: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/files/get-all)

> **files.validate**
>
> ```ts theme={null}
> await api.files.validate({
>   fileId: "us_fl_your_file_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/files/validate)

> **jobs.create**
>
> ```ts theme={null}
> await api.jobs.create({
>   config: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/jobs/create)

> **jobs.get**
>
> ```ts theme={null}
> await api.jobs.get({
>   jobId: "us_job_your_job_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/jobs/get)

> **jobs.update**
>
> ```ts theme={null}
> await api.jobs.update({
>   jobId: "us_job_your_job_id",
>   status: "completed"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/jobs/update)

> **jobs.cancel**
>
> ```ts theme={null}
> await api.jobs.cancel({
>   jobId: "us_job_your_job_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/jobs/cancel)

> **jobs.list**
>
> ```ts theme={null}
> await api.jobs.list({
>   filter: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/jobs/get-all)

> **jobs.logs**
>
> ```ts theme={null}
> await api.jobs.logs({
>   jobId: "us_job_your_job_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/jobs/logs)

> **records.create**
>
> ```ts theme={null}
> await api.records.create({
>   sheetId: "us_sh_your_sheet_id",
>   records: [ ... ]
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/records/create)

> **records.get**
>
> ```ts theme={null}
> await api.records.get({
>   recordId: "us_rec_your_record_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/records/get)

> **records.update**
>
> ```ts theme={null}
> await api.records.update({
>   recordId: "us_rec_your_record_id",
>   data: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/records/update)

> **records.delete**
>
> ```ts theme={null}
> await api.records.delete({
>   recordId: "us_rec_your_record_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/records/delete)

> **records.list**
>
> ```ts theme={null}
> await api.records.list({
>   sheetId: "us_sh_your_sheet_id",
>   filter: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/records/get-all)

> **records.search**
>
> ```ts theme={null}
> await api.records.search({
>   sheetId: "us_sh_your_sheet_id",
>   query: "search term"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/records/search)

> **records.validate**
>
> ```ts theme={null}
> await api.records.validate({
>   records: [ ... ]
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/records/validate)

> **records.bulk.create**
>
> ```ts theme={null}
> await api.records.bulk.create({
>   sheetId: "us_sh_your_sheet_id",
>   records: [ ... ]
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/records/bulk-create)

> **records.bulk.update**
>
> ```ts theme={null}
> await api.records.bulk.update({
>   sheetId: "us_sh_your_sheet_id",
>   records: [ ... ]
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/records/bulk-update)

> **records.bulk.delete**
>
> ```ts theme={null}
> await api.records.bulk.delete({
>   sheetId: "us_sh_your_sheet_id",
>   recordIds: ["us_rec_id1", "us_rec_id2"]
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/records/bulk-delete)

> **sheets.create**
>
> ```ts theme={null}
> await api.sheets.create({
>   workbookId: "us_wb_your_workbook_id",
>   config: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/sheets/create)

> **sheets.get**
>
> ```ts theme={null}
> await api.sheets.get({
>   sheetId: "us_sh_your_sheet_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/sheets/get)

> **sheets.update**
>
> ```ts theme={null}
> await api.sheets.update({
>   sheetId: "us_sh_your_sheet_id",
>   config: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/sheets/update)

> **sheets.delete**
>
> ```ts theme={null}
> await api.sheets.delete({
>   sheetId: "us_sh_your_sheet_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/sheets/delete)

> **sheets.list**
>
> ```ts theme={null}
> await api.sheets.list({
>   workbookId: "us_wb_your_workbook_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/sheets/get-all)

> **sheets.configure**
>
> ```ts theme={null}
> await api.sheets.configure({
>   sheetId: "us_sh_your_sheet_id",
>   config: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/sheets/configure)

> **sheets.getSchema**
>
> ```ts theme={null}
> await api.sheets.getSchema({
>   sheetId: "us_sh_your_sheet_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/sheets/get-schema)

> **sheets.updateSchema**
>
> ```ts theme={null}
> await api.sheets.updateSchema({
>   sheetId: "us_sh_your_sheet_id",
>   schema: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/sheets/update-schema)

> **sheets.commit**
>
> ```ts theme={null}
> await api.sheets.commit({
>   sheetId: "us_sh_your_sheet_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/sheets/commit)

> **spaces.create**
>
> ```ts theme={null}
> await api.spaces.create({
>   config: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/spaces/create)

> **spaces.get**
>
> ```ts theme={null}
> await api.spaces.get({
>   spaceId: "us_sp_your_space_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/spaces/get)

> **spaces.update**
>
> ```ts theme={null}
> await api.spaces.update({
>   spaceId: "us_sp_your_space_id",
>   config: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/spaces/update)

> **spaces.delete**
>
> ```ts theme={null}
> await api.spaces.delete({
>   spaceId: "us_sp_your_space_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/spaces/delete)

> **spaces.list**
>
> ```ts theme={null}
> await api.spaces.list()
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/spaces/get-all)

> **spaces.getMetadata**
>
> ```ts theme={null}
> await api.spaces.getMetadata({
>   spaceId: "us_sp_your_space_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/spaces/get-metadata)

> **spaces.updateMetadata**
>
> ```ts theme={null}
> await api.spaces.updateMetadata({
>   spaceId: "us_sp_your_space_id",
>   metadata: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/spaces/update-metadata)

> **spaces.getMembers**
>
> ```ts theme={null}
> await api.spaces.getMembers({
>   spaceId: "us_sp_your_space_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/spaces/get-members)

> **spaces.addMember**
>
> ```ts theme={null}
> await api.spaces.addMember({
>   spaceId: "us_sp_your_space_id",
>   userId: "us_usr_your_user_id",
>   role: "admin"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/spaces/add-member)

> **spaces.removeMember**
>
> ```ts theme={null}
> await api.spaces.removeMember({
>   spaceId: "us_sp_your_space_id",
>   userId: "us_usr_your_user_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/spaces/remove-member)

> **users.get**
>
> ```ts theme={null}
> await api.users.get({
>   userId: "us_usr_your_user_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/users/get)

> **users.update**
>
> ```ts theme={null}
> await api.users.update({
>   userId: "us_usr_your_user_id",
>   data: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/users/update)

> **users.delete**
>
> ```ts theme={null}
> await api.users.delete({
>   userId: "us_usr_your_user_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/users/delete)

> **users.list**
>
> ```ts theme={null}
> await api.users.list({
>   filter: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/users/get-all)

> **users.invite**
>
> ```ts theme={null}
> await api.users.invite({
>   email: "user@example.com",
>   role: "member"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/users/invite)

> **users.getApiKeys**
>
> ```ts theme={null}
> await api.users.getApiKeys({
>   userId: "us_usr_your_user_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/users/get-api-keys)

> **users.createApiKey**
>
> ```ts theme={null}
> await api.users.createApiKey({
>   userId: "us_usr_your_user_id",
>   config: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/users/create-api-key)

> **users.revokeApiKey**
>
> ```ts theme={null}
> await api.users.revokeApiKey({
>   keyId: "us_key_your_key_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/users/revoke-api-key)

> **workbooks.create**
>
> ```ts theme={null}
> await api.workbooks.create({
>   spaceId: "us_sp_your_space_id",
>   config: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/workbooks/create)

> **workbooks.get**
>
> ```ts theme={null}
> await api.workbooks.get({
>   workbookId: "us_wb_your_workbook_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/workbooks/get)

> **workbooks.update**
>
> ```ts theme={null}
> await api.workbooks.update({
>   workbookId: "us_wb_your_workbook_id",
>   config: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/workbooks/update)

> **workbooks.delete**
>
> ```ts theme={null}
> await api.workbooks.delete({
>   workbookId: "us_wb_your_workbook_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/workbooks/delete)

> **workbooks.list**
>
> ```ts theme={null}
> await api.workbooks.list({
>   spaceId: "us_sp_your_space_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/workbooks/get-all)

> **workbooks.configure**
>
> ```ts theme={null}
> await api.workbooks.configure({
>   workbookId: "us_wb_your_workbook_id",
>   config: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/workbooks)

> **workbooks.getSchema**
>
> ```ts theme={null}
> await api.workbooks.getSchema({
>   workbookId: "us_wb_your_workbook_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/workbooks/get)

> **workbooks.updateSchema**
>
> ```ts theme={null}
> await api.workbooks.updateSchema({
>   workbookId: "us_wb_your_workbook_id",
>   schema: { ... }
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/workbooks/update-schema)

> **workbooks.commit**
>
> ```ts theme={null}
> await api.workbooks.commit({
>   workbookId: "us_wb_your_workbook_id"
> })
> ```
>
> [\< API Reference />](https://reference.flatfile.com/api-reference/workbooks/commit)
