Quick Start: Build a Cases API
Create a working REST API for a client portal from the hosted Spala dashboard.
Quick Start: Build a Cases API
The fastest way to build in Spala is to start with AI Copilot. This guide starts with the Copilot path, then shows the same pieces manually so you understand what Spala creates. Examples use /api/... paths so the published API is easy to recognize from client code.
Hosted dashboard first
Start from the hosted Spala dashboard at https://dashboard.spala.ai. Most users can describe the whole feature to the AI Copilot first; this guide shows the manual editor tour so you understand the pieces Spala creates.
Before you begin
Start from https://dashboard.spala.ai. New users should create an account from the dashboard sign-up screen. If you are joining an existing company workspace, accept the workspace invite first. You also need permission to create or edit a project. This guide should leave you with a tested GET /api/cases endpoint, a published project API base URL, and generated API Docs you can hand to a frontend developer or AI coding agent.
1. Create a project
Open Spala
Open https://dashboard.spala.ai and create an account or sign in. If you are joining an existing company workspace, accept the invite first.
Create a new project
Click New Project on the dashboard. Name it "Legal Client Portal API" and click Create.
2. Fast path: ask AI Copilot
Open Lite Mode
Lite Mode keeps AI Copilot and the project graph visible together. If the project opens in Advanced mode, use the header mode switch to move to Lite Mode.
Describe the feature
Ask Copilot: "Create a cases API for a legal client portal with a cases table, GET /api/cases list endpoint, and POST /api/cases/:id/status update endpoint."
Review the result
Check the generated tables, functions, endpoints, and project graph. Use Ask mode if you want Copilot to explain what it created.
Test and publish
Test the endpoint in Playground, then click Publish when the project draft is ready to become the live API.
Manual tour below
The rest of this guide shows the manual path through Database, Functions, Endpoints, Playground, and Publish. Use it when you want to understand or directly edit the resources Copilot creates.
3. Create the cases table
Open the Database section
Click Database in the left sidebar.
Add a table
Click Add Table and name it cases. Spala creates an id column automatically.
Add fields
Add these fields to your cases table:
| Field Name | Type | Required |
|-------------|-----------------|----------|
| case_number | Text | Yes |
| case_title | Text | Yes |
| status | Text | Yes |
| client_id | Table Reference | No |
| attorney_id | Table Reference | No |
| created_at | Timestamp | No |
Save
Click Save. Your table is saved in the project draft and is ready to use in functions.
The table creation entry point in Spala Create a table from the Database screen.
4. Build a "List Cases" function
Go to Functions
Click Functions in the sidebar, then Create Function. Name it "List Cases".
Add a Database Query step
Open Visual view and add a Database Query step. Configure it:
- Table: cases
- Operation: Select
- Assign To: cases
Add a Return step
Add a Return step after the query. Set its value to:
vars.cases
5. Create the GET /api/cases endpoint
Go to Endpoints
Click Endpoints in the sidebar, then Add Endpoint.
Configure it
- Method: GET
- Path: /api/cases
- Function: List Cases
- Authentication: None
Save
Click Save. Your endpoint is saved in the project draft and ready to test.
6. Test it in the Playground
Open the Playground
Click Playground in the sidebar. Select your GET /api/cases endpoint.
Send a request
Click Send. You will see an empty array [] since there is no case data yet.
Add some cases
Go back to Database, click the cases table, and use the Data tab to add a few rows. Then test the endpoint again.
7. Publish it
Open Publish
Click Publish in the header when the table, function, and endpoint look right.
Review the changes
Review the pending changes, then publish. After publishing, your endpoint is available from your project's API base URL.
The Spala publish dialog Review pending changes before publishing your backend.
8. Confirm the live API
After publish, complete this checklist before giving the backend to a frontend builder:
1. Copy the project API base URL from Lite Mode or Project Overview. 2. Open Settings → API Docs and confirm GET /api/cases appears. 3. Test the live endpoint from API Playground. 4. Copy the generated Markdown docs, OpenAPI JSON, or SDK if another person or agent is building the frontend. 5. Add your frontend origin in Settings → Security → CORS Allowed Origins if browser calls are blocked.
First frontend call:
const API_BASE_URL = import.meta.env.VITE_SPALA_API_BASE_URL;
const response = await fetch(`${API_BASE_URL}/api/cases`);
if (!response.ok) {
throw new Error(`Spala API error: ${response.status}`);
}
const cases = await response.json();
Bonus: Add an "Update Case Status" endpoint
Take it further by creating a POST /api/cases/:id/status endpoint:
Create a new function
Add a function called "Update Case Status".
Add a Database Query step
Configure it:
- Table: cases
- Operation: Update
- Set: status to input.status
- Where: id = params.id
- Assign To: updatedCase
Return the result
Add a Return step with value vars.updatedCase.
Create the endpoint
Add a POST endpoint at /api/cases/:id/status, attach the function, save it, test it, then publish when it is ready.
Pro tip
You can build the whole feature with the AI Copilot. Describe what you want: "Create a cases API for a legal client portal with GET /api/cases and POST /api/cases/:id/status endpoints."
Using an AI coding agent
If you want Codex, Claude, Cursor, or another MCP client to help with the backend, connect the public Spala MCP first:
codex mcp add spala-public --url "https://mcp.spala.ai/mcp"
The public MCP is for discovery, OAuth metadata, project lookup, and handoff. After authentication, let Spala return the selected project MCP URL. Do not hardcode a URL such as https://api.spala.ai/{project}/mcp.
What's next?
Spala Public MCP /agents/mcp Connect an AI coding assistant to Spala The Interface /getting-started/interface Learn your way around the Spala UI Database /database Tables, fields, and relationships Functions /flows All the ways to build backend logic API Endpoints /endpoints Methods, paths, authentication, and more