5-minute quickstart

Go from zero to querying your first EmuView API in under five minutes.

#5-minute quickstart

By the end of this guide, you'll have an EmuView project with a collection, sample data, and a working API query.

#Prerequisites

  • An EmuView account (self-hosted or cloud)
  • An API key or user credentials
  • curl or any HTTP client (the SDK is optional)

#Steps

#1. Sign in and get an API key

Sign in to the EmuView dashboard. Navigate to Settings → API Keys and click New API Key. Give it a label like "Dev key" and copy the generated sk- prefixed key.

Important

The full API key is shown once. Copy it now and store it securely.

If you prefer to use email/password authentication instead, sign in to get a session token:

curl -X POST https://your-api.example.com/api/auth/sign-in/email \
  -H "Content-Type: application/json" \
  -d '{"email": "alex@example.com", "password": "securePassword123"}'
{
	"token": "eyJhbGciOiJIUzI1NiIs...",
	"user": {
		"id": "usr_abc123",
		"email": "alex@example.com",
		"name": "Alex Chen",
		"role": "admin"
	}
}

#2. Create a collection

Create a posts collection with title, body, and status fields:

#HTTP
curl -X POST https://your-api.example.com/api/v1/collections \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "posts",
    "storageType": "d1",
    "fields": [
      {"name": "title", "type": "text", "required": true, "indexed": true},
      {"name": "body", "type": "richtext", "required": false},
      {"name": "status", "type": "enum", "required": true, "enumValues": ["draft", "published", "archived"]}
    ]
  }'
#SDK
import { EmuView } from '@emuview/sdk';

const sdk = new EmuView({
	url: 'https://your-api.example.com',
	auth: { apiKey: 'sk-your-api-key' }
});

// The SDK doesn't have a schema management method — use fetch for collection creation
const res = await fetch('https://your-api.example.com/api/v1/collections', {
	method: 'POST',
	headers: {
		Authorization: 'Bearer sk-your-api-key',
		'Content-Type': 'application/json'
	},
	body: JSON.stringify({
		name: 'posts',
		storageType: 'd1',
		fields: [
			{ name: 'title', type: 'text', required: true, indexed: true },
			{ name: 'body', type: 'richtext', required: false },
			{
				name: 'status',
				type: 'enum',
				required: true,
				enumValues: ['draft', 'published', 'archived']
			}
		]
	})
});
const collection = await res.json();

#3. Add a record

Insert your first blog post:

#HTTP
curl -X POST https://your-api.example.com/api/v1/collections/posts/records \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Hello from EmuView",
    "body": "<p>This is my first post created via the API.</p>",
    "status": "published"
  }'
#SDK
const post = await sdk.collection('posts').create({
	title: 'Hello from EmuView',
	body: '<p>This is my first post created via the API.</p>',
	status: 'published'
});
// post → { id: 'b10b0196...', title: 'Hello from EmuView', status: 'published', created_at: 1718900000, ... }

#4. Query the API

Fetch published posts, sorted by newest first:

#HTTP
curl "https://your-api.example.com/api/v1/collections/posts/records?filter=%7B%22status%22:%7B%22_eq%22:%22published%22%7D%7D&sortBy=created_at&order=desc&limit=10" \
  -H "Authorization: Bearer sk-your-api-key"
#SDK
const results = await sdk.collection('posts').list({
	filter: { status: { _eq: 'published' } },
	sortBy: '-created_at',
	limit: 10
});
// results → { data: [...], total: 1, page: 1, limit: 10, hasMore: false }

for (const post of results.data) {
	console.log(`${post.title} — ${post.status}`);
}

#5. Verify in the dashboard

Open the EmuView dashboard and navigate to Collections → posts. You should see your record listed with all system fields (id, created_at, updated_at, created_by) populated automatically.

#What you learned

  • How to authenticate with an API key
  • How to create a collection with typed fields
  • How to insert and query records via the REST API and SDK
  • That system fields (id, created_at, updated_at, created_by, updated_by) are managed automatically

#Next steps