Authentication

All requests must include a Bearer token in the Authorization header. The token is the value of the AUTH_TOKEN environment variable.

Authorization: Bearer YOUR_TOKEN

If no AUTH_TOKEN is set on the server, auth is skipped entirely.

Data Model

Investor Object

FieldTypeDescription
idintegerAuto-incrementing primary key
namestringInvestor name REQUIRED
emailstring | nullEmail address
companystring | nullCompany / fund name
stagestringOne of: target, contacted, interested, yes, no
notesstring | nullFree-text notes
created_attimestampISO 8601 creation time
updated_attimestampISO 8601 last update time

Endpoints

GET /api/investors List all investors

Returns all investors, ordered by most recently updated. Optionally filter by stage.

Query Parameters

ParamTypeDescription
stagestring optionalFilter by stage: target, contacted, interested, yes, no
Example Request
curl -H "Authorization: Bearer TOKEN" \
  https://your-app.vercel.app/api/investors?stage=interested
Response 200
[
  {
    "id": 1,
    "name": "Jane Smith",
    "email": "jane@acme.vc",
    "company": "Acme Capital",
    "stage": "interested",
    "notes": "Wants to see traction metrics",
    "created_at": "2026-01-15T10:30:00.000Z",
    "updated_at": "2026-02-10T14:20:00.000Z"
  }
]
POST /api/investors Create an investor

Creates a new investor. Only name is required. Stage defaults to target.

Request Body (JSON)

FieldTypeDescription
namestring requiredInvestor name
emailstring optionalEmail address
companystring optionalCompany / fund name
stagestring optionalInitial stage (defaults to target)
notesstring optionalFree-text notes
Example Request
curl -X POST https://your-app.vercel.app/api/investors \
  -H "Authorization: Bearer TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "Jane Smith", "company": "Acme Capital", "email": "jane@acme.vc"}'
Response 201
{
  "id": 1,
  "name": "Jane Smith",
  "email": "jane@acme.vc",
  "company": "Acme Capital",
  "stage": "target",
  "notes": null,
  "created_at": "2026-02-16T10:30:00.000Z",
  "updated_at": "2026-02-16T10:30:00.000Z"
}
GET /api/investors/:id Get single investor

Returns a single investor by ID.

Example Request
curl -H "Authorization: Bearer TOKEN" \
  https://your-app.vercel.app/api/investors/1
Response 200
{
  "id": 1,
  "name": "Jane Smith",
  "email": "jane@acme.vc",
  "company": "Acme Capital",
  "stage": "target",
  "notes": null,
  "created_at": "2026-02-16T10:30:00.000Z",
  "updated_at": "2026-02-16T10:30:00.000Z"
}
Response 404
{ "error": "Investor not found" }
PUT /api/investors/:id Full update

Replaces all fields on the investor. name is required. Omitted optional fields become null.

Request Body (JSON)

FieldTypeDescription
namestring requiredInvestor name
emailstring optionalEmail address
companystring optionalCompany / fund name
stagestring optionalStage (defaults to target)
notesstring optionalFree-text notes
Example Request
curl -X PUT https://your-app.vercel.app/api/investors/1 \
  -H "Authorization: Bearer TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "Jane Smith", "company": "Acme Capital", "stage": "contacted"}'
PATCH /api/investors/:id Partial update / move stage

Updates only the fields you send. Omitted fields keep their current values. Best way to move an investor between stages.

Request Body (JSON)

FieldTypeDescription
namestring optionalInvestor name
emailstring optionalEmail address
companystring optionalCompany / fund name
stagestring optionalMove to stage: target, contacted, interested, yes, no
notesstring optionalFree-text notes
Example: Move to "interested"
curl -X PATCH https://your-app.vercel.app/api/investors/1 \
  -H "Authorization: Bearer TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"stage": "interested"}'
Example: Update notes only
curl -X PATCH https://your-app.vercel.app/api/investors/1 \
  -H "Authorization: Bearer TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"notes": "Follow up next week"}'
DELETE /api/investors/:id Delete an investor

Permanently deletes an investor by ID.

Example Request
curl -X DELETE -H "Authorization: Bearer TOKEN" \
  https://your-app.vercel.app/api/investors/1
Response 200
{
  "deleted": {
    "id": 1,
    "name": "Jane Smith",
    ...
  }
}
GET /api/investors/stats Pipeline summary

Returns the total count and a breakdown by stage.

Example Request
curl -H "Authorization: Bearer TOKEN" \
  https://your-app.vercel.app/api/investors/stats
Response 200
{
  "total": 12,
  "by_stage": [
    { "stage": "target", "count": 5 },
    { "stage": "contacted", "count": 3 },
    { "stage": "interested", "count": 2 },
    { "stage": "yes", "count": 1 },
    { "stage": "no", "count": 1 }
  ]
}

Error Responses

All errors return a JSON object with an error field.

StatusMeaning
400Bad request (missing required field, invalid stage, invalid ID)
401Unauthorized (missing or invalid Bearer token)
404Investor not found
405Method not allowed
500Internal server error