Skip to main content

Get Record

Retrieve individual records from your Boltic Tables by their unique identifier. The SDK provides simple methods for fetching single records with full type safety.

Get Record Operations

The SDK provides two approaches for retrieving individual records:

findOne() - Get Single Record by ID

Retrieve a specific record by its ID.

client.records.findOne(
tableName: string,
recordId: string,
options?: { show_decrypted?: boolean; dbId?: string }
): Promise<ApiResponse<RecordWithId>>

Parameters

ParameterTypeRequiredDescription
tableNamestringName of the table
recordIdstringID of the record to retrieve
optionsobjectOptional parameters for record retrieval

Options

PropertyTypeDefaultDescription
show_decryptedbooleanfalseShow decrypted values for encrypted columns
dbIdstring-Custom database ID (for multi-database configurations)
Encrypted Column Behavior

By default, encrypted column values are masked as ******** in the response. Set show_decrypted: true to retrieve decrypted values.

Examples

Direct Approach

import { createClient } from "@boltic/sdk";

const client = createClient("your-api-key");

const recordId = "rec_123456789";

// Retrieve record (encrypted columns will be masked by default)
const { data: record, error } = await client.records.findOne("users", recordId);

if (error) {
console.error("Record not found:", error.message);
} else {
console.log("Record details:", {
id: record.id,
name: record.name,
email: record.email,
api_key: record.api_key, // Shows: "********"
});
}

// Retrieve record with decrypted values
const { data: user, error: decryptionError } = await client.records.findOne("users", recordId, {
show_decrypted: true,
});

console.log("Decrypted values:", {
api_key: user.api_key, // Shows actual decrypted value
ssn: user.ssn, // Shows actual decrypted value
});

Response Format

Successful Response

interface GetRecordResponse {
data: {
id: string;
created_at: string;
updated_at: string;
[fieldName: string]: unknown;
};
error: null;
}

Error Response

interface GetRecordErrorResponse {
data: null;
error: {
message: string;
meta?: string[];
};
}