How to

Create a Company

Use the Companies API to register a tenant before adding agents.

Create a Company

Companies are persisted in PostgreSQL via the /api/companies route (packages/server/src/routes/companies.route.ts). Each agent row references a companyId, so creating a company is the first onboarding step.

Prerequisites

  • Server running on http://localhost:3001 (or your deployed base URL).
  • A bearer token generated via pnpm api-key and configured in the API_KEYS env variable.
  • Postman or curl with the Authorization: Bearer <token> header.

Endpoint

  • Method: POST /api/companies
  • Authentication: Required (validateApiKey)
  • Body schema: name is required, description and metadata fields follow the Drizzle schema.

Example request

curl -X POST http://localhost:3001/api/companies \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TELLYO_API_KEY" \
  -d '{
    "name": "OneNine Innovations",
    "description": "AI-first consultancy focused on automation rollouts"
  }'

Successful responses return the full company row (UUID, timestamps). Validation errors originate from createCompanySchema, which is derived from packages/server/src/db/schema/companies.schema.ts.

Verification and follow-up actions

  1. GET /api/companies – confirm your company exists.
  2. GET /api/companies/{companyId} – fetch full details.
  3. GET /api/companies/{companyId}/agents – initially empty, but useful for sanity checks after agent creation.

You can now create an agent that references this companyId. Continue with Create an Agent.