The FileMaker Data API is a REST API built into FileMaker Server and FileMaker Cloud. It lets a website, web form or customer portal read and write your FileMaker data with ordinary HTTPS requests and JSON, with no FileMaker Pro installed anywhere. It's the most common way I connect client websites to their FileMaker systems.
How a request flows
- Log in. Your server sends a
POSTto/fmi/data/vLatest/databases/{database}/sessions, with the account name and password as HTTP Basic authentication. FileMaker returns a session token. - Work with records. Every later call sends that token as
Authorization: Bearer {token}. You can find, create, edit and delete records, upload to container fields and run scripts. - Log out. A
DELETEto/sessions/{token}ends the session. A token also expires 15 minutes after the last call that used it.
Every request targets a layout, not a table. The layout decides which fields the API can see, which makes it your first security boundary.
Keep FileMaker credentials on the server
The most common mistake is calling the Data API straight from JavaScript in the browser. Anything in the browser can be read by anyone who opens the developer tools, including an account name and password. Instead, put a thin proxy on your server that holds the credentials, calls FileMaker and returns only the data the page needs. Node.js suits the job well. It's the same JavaScript your front end already uses, and because a Node.js server keeps running between requests, it can hold one session token and reuse it.
Here's the core of that proxy, using Node.js 18 or later (which has fetch built in) and Express. The page calls /api/products, and the server signs in, runs a find and returns only names and prices:
// server.js: runs on your server (Node.js 18+ with Express), never in
// the browser. Credentials come from environment variables.
const express = require('express');
const DB = encodeURIComponent('Inventory');
const BASE = `https://fms.example.com/fmi/data/vLatest/databases/${DB}`;
const FIND = { query: [{ Status: 'Active' }], limit: 50 };
let token = null; // one session token, reused across requests
async function fm(method, path, body, auth = `Bearer ${token}`) {
const res = await fetch(BASE + path, {
method,
headers: { 'Content-Type': 'application/json', Authorization: auth },
body: body === undefined ? undefined : JSON.stringify(body),
});
return res.json();
}
async function logIn() {
const { FM_USER, FM_PASS } = process.env;
const basic = Buffer.from(`${FM_USER}:${FM_PASS}`).toString('base64');
const result = await fm('POST', '/sessions', {}, `Basic ${basic}`);
token = result.response?.token ?? null;
if (!token) throw new Error('Could not sign in to FileMaker');
}
const app = express();
// The page calls /api/products. Only this server talks to FileMaker.
app.get('/api/products', async (req, res) => {
try {
if (!token) await logIn();
let result = await fm('POST', '/layouts/web_products/_find', FIND);
if (result.messages?.[0]?.code === '952') { // token expired
await logIn();
result = await fm('POST', '/layouts/web_products/_find', FIND);
}
const code = result.messages?.[0]?.code;
if (code !== '0' && code !== '401') throw new Error(`FileMaker ${code}`);
// 401 means no records match: send back an empty list.
const products = (result.response?.data ?? []).map((r) => ({
name: r.fieldData.Name,
price: r.fieldData.Price,
}));
res.json(products);
} catch {
res.status(502).json({ error: 'FileMaker is unavailable right now.' });
}
});
app.listen(3000);
There's no log-out call, because the token is kept and reused. When FileMaker expires it after 15 minutes without use, the next request comes back with error 952, so the proxy signs in again and retries once.
Make the connection fast and safe
- Use a dedicated account. Create an account just for the website, with a privilege set that only reaches the layouts and records it needs, and the
fmrestextended privilege turned on. Make sure the Data API itself is enabled in the FileMaker Server Admin Console. - Build web-only layouts. Put only the fields the website needs on a layout such as
web_products. Smaller layouts mean faster responses and less exposed data. - Reuse the session token. Logging in on every page view is slow. Keep the token on the server and reuse it until it expires, as the example does.
- Treat "no records" as normal. A find with no matches comes back as FileMaker error
401rather than an empty list, so handle it as an empty result, not a failure. - Use HTTPS with a valid certificate on FileMaker Server, and validate everything the website sends before it reaches FileMaker.
Data API, OData or something else?
The Data API is the best fit for web apps that create and edit individual records. FileMaker Server also offers an OData API, which suits reporting tools and integrations that think in tables and queries. On FileMaker Cloud, sign-in uses a Claris ID token instead of a FileMaker account name and password, but the record requests work the same way.
Need a website, form or portal connected to your FileMaker system? Let's talk about it.