Explore working examples that demonstrate common SDK operations. Start with basic vault operations like insert-records.ts, then explore other samples for specific use cases.
- A Skyflow account. If you don't have one, register for one on the Try Skyflow page.
- Node 7.6.0 and above.
Install the Node SDK:
npm install skyflow-node- Navigate to Skyflow Studio in your browser.
- Click Create Vault > Start With a Template > Quickstart vault.
- When the vault is ready, click the gear icon and select Edit Vault Details.
- Copy your Vault URL and Vault ID, then click Cancel.
- In the side navigation, click Access > Service Accounts > New Service Account.
- Enter "SDK Samples" for Name and choose Vault Editor for Roles.
- Click Create. Your browser downloads a credentials.json file. Store this file securely.
Sample files are organized by API type:
vault-api/- Vault operations (insert, get, update, delete, tokenize, detokenize)detect-api/- Detect operations (deidentify, reidentify)service-account/- Token generation examples
-
Open the sample file you want to run (for example,
vault-api/insert-records.ts) -
Update placeholder values:
Placeholder Replace With <VAULT_ID>Your Vault ID from Skyflow Studio <CLUSTER_ID>Your Cluster ID from the vault URL <YOUR_CREDENTIAL_FILE>Relative path to your actual credentials file <TABLE_NAME>The name of a table in your vault (for example, users)<COLUMN_NAME>The name of a column in your table (for example, name)<ID1>,<ID2>, etc.Actual record IDs from your vault <VALUE>Actual values to insert into your vault <TOKEN1>,<TOKEN2>, etc.Actual tokens from your vault <CONNECTION_URL>Your connection URL -
Run the sample:
cd samples npm install ts-node vault-api/insert-records.ts
Vault API samples (vault-api/):
insert-records.ts- Insert data and get tokensinsert-continue-on-error.ts- Bulk insert with per-record error handlinginsert-byot.ts- Insert with bring-your-own tokens (BYOT)get-records.ts- Retrieve records by Skyflow IDsget-column-values.ts- Query by column valuesdetokenzie-records.ts- Convert tokens to valuestokenize-records.ts- Get tokens for existing valuesupdate-record.ts- Update existing recordsdelete-records.ts- Delete records by IDquery-records.ts- SQL query operationsfile-upload.ts- Upload files to vault (file path, base64, or File object)invoke-connection.ts- Call external integrationsclient-operations.ts- Runtime vault and connection managementcredentials-options.ts- All credential types and multi-vault setupdata-residency.ts- Multi-region vault configuration
Detect API samples (detect-api/):
deidentify-text.ts- Anonymize text datadeidentify-file.ts- Anonymize a file using a File objectdeidentify-file-with-filepath.ts- Anonymize a file using a file pathdeidentify-file-with-filepath-async.ts- Anonymize a file asynchronously (poll for result)reidentify-text.ts- Restore original values from de-identified textget-detect-run.ts- Check the status of an async de-identify operation
Service Account samples (service-account/):
token-generation-example.ts- Generate bearer tokensscoped-token-generation-example.ts- Role-scoped tokenstoken-generation-with-context-example.ts- Context-aware tokenssigned-token-generation-example.ts- Signed data tokensbearer-token-expiry-example.ts- Handle token expiration
For detailed API documentation, see the main README.