Send Events
Emit a single event into Meshes using either a publishable key (client-side) or a machine JWT (server-side).
Use this endpoint to emit a single event:
POST https://api.meshes.io/api/v1/events
You can authenticate with either:
X-Meshes-Publishable-Key(recommended for client-side), orAuthorization: Bearer <jwt>(server-side only)
Request
Headers (publishable key)
-H "X-Meshes-Publishable-Key: <WORKSPACE_PUBLISHABLE_KEY>" -H "Content-Type: application/json"
Body
At minimum, send:
event(string): Your event name (e.g. contact.created)payload(object): Event data (arbitrary JSON)
Optional fields:
resource(string)resource_id(string)workspace(uuid) — typically inferred from the publishable key; include only if your usage requires it
Example: curl (publishable key)
curl -X POST https://api.meshes.io/api/v1/events \
-H "X-Meshes-Publishable-Key: <WORKSPACE_PUBLISHABLE_KEY>" \
-H "Content-Type: application/json" \
-d '{
"event": "contact.created",
"payload": {
"id": "lead_123",
"email": "jane@example.com",
"first_name": "Jane",
"last_name": "Doe",
"utm_source": "google-ads"
}
}'
Example: TypeScript (Meshes client)
import { MeshesEventsClient } from '@mesheshq/events';
const client = new MeshesEventsClient(process.env.WORKSPACE_PUBLISHABLE_KEY!);
await client.emit({
event: 'contact.created',
payload: {
email: 'jane@example.com',
first_name: 'Jane',
last_name: 'Doe',
utm_source: 'google-ads',
},
});
Responses
201 Created— event accepted and queued for processing400 Bad Request— invalid payload401 Unauthorized— missing/invalid key or token429 Too Many Requests— rate limit exceeded500 Internal Error