Better I18NBetter I18N

Quick Start

Get the Admin SDK running in under 2 minutes

Install

npm install @better-i18n/admin

Create a client

import { createAdminClient } from '@better-i18n/admin'

const admin = createAdminClient({
  apiKey: process.env.BETTER_I18N_API_KEY,
  projectId: 'nomadvibe/packervibe' // Dashboard → Settings → Project ID
})

The projectId uses slug format (org/project), the same value shown in your dashboard under Settings → General → Project ID. All SDK calls are automatically scoped to this project.

API key

Use the same API key you use for the MCP server or CLI. This is a server-side secret key (bi- prefix) — never expose it in client-side code.

Find it in your dashboard: Settings → API Keys → Create Key.

Public keys (bi_pub_ prefix) cannot access admin endpoints. They are designed for client-side content fetching only.

Example: Next.js API route

app/api/analytics/route.ts
import { createAdminClient } from '@better-i18n/admin'

const admin = createAdminClient({
  apiKey: process.env.BETTER_I18N_API_KEY!,
  projectId: process.env.BETTER_I18N_PROJECT_ID!
})

export async function GET() {
  const views = await admin.analytics.views('blog-posts')
  return Response.json(views)
}

Example: Express middleware

server.ts
import { createAdminClient } from '@better-i18n/admin'
import express from 'express'

const admin = createAdminClient({
  apiKey: process.env.BETTER_I18N_API_KEY!,
  projectId: 'nomadvibe/packervibe'
})

const app = express()

app.get('/api/popular-posts', async (req, res) => {
  const stats = await admin.analytics.stats('blog-posts', { period: '7d' })
  const popular = stats.viewsByEntry.slice(0, 5)
  res.json(popular)
})

Available namespaces

NamespaceMethods
admin.projectslist(), get()
admin.keyslist(), create(), update(), delete()
admin.translationsget(), set(), publish(), context(), pendingChanges()
admin.content.modelslist(), get(), create(), update(), delete()
admin.content.fieldsadd(), update(), remove(), reorder()
admin.content.entrieslist(), get(), create(), update(), publish(), delete(), duplicate(), bulkCreate(), bulkUpdate(), bulkPublish()
admin.analyticsviews(), stats()
admin.synclist(), get(), cancel()
admin.languagesadd(), update(), delete()

On this page