{"title":"NinjaPipe API Documentation","version":"1.0.0","baseUrl":"http://localhost:3001/api","description":"NinjaPipe CRM API for managing contacts, contact timeline activities (notes and tasks), companies, and more.","authentication":{"type":"API Key","header":"Authorization: Bearer your_api_key_here","description":"All API requests require a valid API key in the Authorization header."},"rateLimits":{"requests":"100 requests per minute per API key","description":"Rate limits are applied per API key to ensure fair usage."},"endpoints":{"contacts":{"basePath":"/api/contacts","description":"Manage contacts in your workspace","GET /api/contacts":{"description":"List all contacts","parameters":{"page":{"type":"integer","default":1,"description":"Page number for pagination"},"limit":{"type":"integer","default":20,"max":100,"description":"Number of contacts per page"},"search":{"type":"string","description":"Search in name, email, and phone fields"},"status":{"type":"string","description":"Filter by contact status"},"owner_id":{"type":"string","description":"Filter by contact owner (record ownership; not the Assign to field)"},"assigned_to":{"type":"string","description":"Filter by assigned team member account UUID (Assign to in the app)"},"sort_by":{"type":"string","default":"created_at","options":["created_at","updated_at","first_name","last_name","email"]},"sort_order":{"type":"string","default":"desc","options":["asc","desc"]}},"response":{"data":"Array of contact objects","pagination":"Pagination information","meta":"Request metadata"}},"POST /api/contacts":{"description":"Create a new contact","body":{"first_name":{"type":"string","required":false,"description":"Contact first name"},"last_name":{"type":"string","required":false,"description":"Contact last name"},"email":{"type":"string","required":false,"description":"Contact email address"},"phone":{"type":"string","required":false,"description":"Contact phone number"},"status":{"type":"string","default":"Active","description":"Contact status"},"owner_id":{"type":"string","required":false,"description":"Record owner account ID (distinct from assigned_to)"},"assigned_to":{"type":"string","required":false,"description":"Assigned team member account UUID, email, or unique display name (Assign to in the app)"},"company_id":{"type":"string","required":false,"description":"Associated company ID"},"fields":{"type":"object","required":false,"description":"Custom fields as key-value pairs"}},"response":{"data":"Created contact object","message":"Success message"}},"GET /api/contacts/:id":{"description":"Get a specific contact by ID","parameters":{"id":{"type":"string","required":true,"description":"Contact UUID"}},"response":{"data":"Contact object with full details"}},"PUT /api/contacts/:id":{"description":"Update a specific contact","parameters":{"id":{"type":"string","required":true,"description":"Contact UUID"}},"body":{"first_name":{"type":"string","required":false},"last_name":{"type":"string","required":false},"email":{"type":"string","required":false},"phone":{"type":"string","required":false},"status":{"type":"string","required":false},"owner_id":{"type":"string","required":false,"description":"Record owner account ID (distinct from assigned_to)"},"assigned_to":{"type":"string","required":false,"description":"Assigned team member account UUID, email, unique display name, or null to unassign"},"company_id":{"type":"string","required":false},"fields":{"type":"object","required":false}},"response":{"data":"Updated contact object","message":"Success message"}},"DELETE /api/contacts/:id":{"description":"Delete a specific contact","parameters":{"id":{"type":"string","required":true,"description":"Contact UUID"}},"response":{"message":"Success message","data":"Deleted contact information"}},"POST /api/contacts/:id/meta-tags":{"description":"Assign one or more workspace meta tags to a contact. Idempotent. Does not remove tags that are omitted. Fires meta tag added workflows for newly assigned tags.","parameters":{"id":{"type":"string","required":true,"description":"Contact UUID"}},"body":{"meta_tag_ids":{"type":"array","required":false,"description":"Meta tag UUIDs (max 100). A single UUID string is also accepted."},"meta_tag_id":{"type":"string","required":false,"description":"One meta tag UUID. Use this or meta_tag_ids. Both may be sent and are combined."}},"response":{"data":"{ contact_id, meta_tags: [{ id, name }], assigned: [{ id, name }], already_assigned: [{ id, name }] }","message":"Meta tags assigned, or Meta tags already assigned"}},"POST /api/contacts/:id/meta-tags/remove":{"description":"Unassign one or more meta tags from a contact. Tags that are not currently assigned are reported in not_assigned. Requires write permission (this is not an HTTP DELETE).","parameters":{"id":{"type":"string","required":true,"description":"Contact UUID"}},"body":{"meta_tag_ids":{"type":"array","required":false,"description":"Meta tag UUIDs to remove (max 100)"},"meta_tag_id":{"type":"string","required":false,"description":"One meta tag UUID to remove"}},"response":{"data":"{ contact_id, meta_tags, unassigned, not_assigned }","message":"Meta tags unassigned, or Meta tags were not assigned"}}},"companies":{"basePath":"/api/companies","description":"Assign and unassign workspace meta tags on companies. Company create/read/update/delete routes also live under this path.","POST /api/companies/:id/meta-tags":{"description":"Assign one or more workspace meta tags to a company. Same body and idempotent behavior as contacts.","parameters":{"id":{"type":"string","required":true,"description":"Company UUID"}},"body":{"meta_tag_ids":{"type":"array","required":false,"description":"Meta tag UUIDs (max 100)"},"meta_tag_id":{"type":"string","required":false,"description":"One meta tag UUID"}},"response":{"data":"{ company_id, meta_tags, assigned, already_assigned }","message":"Meta tags assigned, or Meta tags already assigned"}},"POST /api/companies/:id/meta-tags/remove":{"description":"Unassign one or more meta tags from a company. Same body as assign.","parameters":{"id":{"type":"string","required":true,"description":"Company UUID"}},"body":{"meta_tag_ids":{"type":"array","required":false,"description":"Meta tag UUIDs to remove (max 100)"},"meta_tag_id":{"type":"string","required":false,"description":"One meta tag UUID to remove"}},"response":{"data":"{ company_id, meta_tags, unassigned, not_assigned }","message":"Meta tags unassigned, or Meta tags were not assigned"}}},"workspace":{"basePath":"/api/workspace","description":"Workspace metadata and team members","GET /api/workspace/members":{"description":"List active workspace members (account UUIDs for assigned_to and integrations)","response":{"data":"Array of { account_id, email, first_name, last_name, full_name, role, joined_at }","meta":"workspace_id, total"}}},"contactActivities":{"basePath":"/api/contacts/:contactId/activities","description":"Contact timeline activities (notes and tasks). Tasks are stored in the workspace project for the contact; creating a task activity inserts a task row, then a contact_activities row, then updates the task with settings_json.contact_activity_id. Updates to tasks via PUT /api/projects/:projectId/tasks/:taskId sync the linked activity when contact_activity_id is set. Deleting a task via the tasks API removes the linked activity when present.","GET /api/contacts/:contactId/activities":{"description":"List activities for a contact (timeline), newest first","parameters":{"contactId":{"type":"string","required":true,"description":"Contact UUID"},"page":{"type":"integer","default":1,"description":"Page number"},"limit":{"type":"integer","default":50,"max":100,"description":"Page size"},"type":{"type":"string","description":"Optional filter: comma-separated types, e.g. note,task"}},"response":{"data":"Array of contact_activities rows","pagination":"page, limit, total, pages","meta":"contact_id, workspace_id"}},"GET /api/contacts/:contactId/activities/:activityId":{"description":"Get one activity by ID (must belong to the contact and workspace)","parameters":{"contactId":{"type":"string","required":true,"description":"Contact UUID"},"activityId":{"type":"string","required":true,"description":"Activity UUID"}},"response":{"data":"Activity object"}},"POST /api/contacts/:contactId/activities":{"description":"Create a note or task activity","parameters":{"contactId":{"type":"string","required":true,"description":"Contact UUID"}},"body":{"type":{"type":"string","required":true,"description":"Must be 'note' or 'task'"},"noteFields":{"title":{"type":"string","description":"Note title"},"content":{"type":"string","description":"Note body (stored in data.content)"},"date":{"type":"string","description":"ISO date/time for timeline"},"is_draft":{"type":"boolean"},"is_new":{"type":"boolean"}},"taskFields":{"title":{"type":"string","required":true,"description":"Task title"},"description":{"type":"string"},"status":{"type":"string","description":"To Do | In Progress | Done | Cancelled","default":"To Do"},"priority":{"type":"string","description":"High | Medium | Low","default":"Medium"},"due_date":{"type":"string","description":"YYYY-MM-DD"},"assignees":{"type":"array","description":"Assignee account IDs (stored on task settings_json)"},"date":{"type":"string","description":"Activity timeline date (ISO)"}}},"response":{"note":{"data":"Created activity"},"task":{"data":"{ activity, task }","message":"Success message"}}},"PATCH /api/contacts/:contactId/activities/:activityId":{"description":"Update a note, or update a task-linked activity (updates the underlying task and syncs activity data). Optional body.date updates timeline date for task activities.","parameters":{"contactId":{"type":"string","required":true},"activityId":{"type":"string","required":true}},"body":{"note":{"title":{"type":"string"},"content":{"type":"string"},"date":{"type":"string"},"is_draft":{"type":"boolean"},"is_new":{"type":"boolean"}},"task":{"title":{"type":"string"},"description":{"type":"string"},"status":{"type":"string"},"priority":{"type":"string"},"due_date":{"type":"string"},"assignees":{"type":"array"},"date":{"type":"string","description":"Timeline date on the activity"}}},"response":{"note":{"data":"Updated activity"},"task":{"data":"{ activity, task }"}}},"DELETE /api/contacts/:contactId/activities/:activityId":{"description":"Delete an activity. For type task, deletes the linked task first (when task_id is present), then the activity.","parameters":{"contactId":{"type":"string","required":true},"activityId":{"type":"string","required":true}},"response":{"message":"Success message"}}},"metaTags":{"basePath":"/api/meta-tags","description":"Workspace meta tag catalog. Name max 10 characters. Description max 35.","GET /api/meta-tags":{"description":"List meta tags. Query: page, limit, search."},"POST /api/meta-tags":{"description":"Create a meta tag. Body: name (required), description, icon, color. Requires write."},"GET /api/meta-tags/:id":{"description":"Get one meta tag."},"PUT /api/meta-tags/:id":{"description":"Update a meta tag. Requires write."},"DELETE /api/meta-tags/:id":{"description":"Delete a catalog row only. Requires write."}},"customFields":{"basePath":"/api/custom-fields","description":"Custom field definitions. Values stay on each record in fields.","GET /api/custom-fields":{"description":"List definitions. Query: page, limit, type."},"POST /api/custom-fields":{"description":"Create a definition. Body: label, type. Optional description, settings_json. Requires write."},"GET /api/custom-fields/:id":{"description":"Get one definition."},"PUT /api/custom-fields/:id":{"description":"Update a definition. Requires write."},"DELETE /api/custom-fields/:id":{"description":"Delete a definition. Does not clear stored values. Requires write."}},"formSubmissions":{"basePath":"/api/forms/:id/submissions","description":"Read form submissions. The form must belong to the API key workspace.","GET /api/forms/:id/submissions":{"description":"List submissions. Query: page, limit, contact_id."},"GET /api/forms/:id/submissions/:submissionId":{"description":"Get one submission."}},"bookings":{"basePath":"/api/bookings","description":"List and update booking status. Creating a booking stays on the booking page. Stripe ids are omitted.","GET /api/bookings":{"description":"List bookings. Query: page, limit, status, booking_page_id, contact_id, from, to."},"GET /api/bookings/:id":{"description":"Get one booking."},"PUT /api/bookings/:id":{"description":"Body: { status }. pending, confirmed, cancelled, completed, no_show, pending_payment. Requires write."}},"webhooks":{"basePath":"/api/webhooks","description":"Outbound webhook subscriptions. secret is returned only on create.","GET /api/webhooks":{"description":"List active subscriptions without secrets."},"POST /api/webhooks":{"description":"Body: webhook_url, event_types (non-empty array of known events). Requires write."},"DELETE /api/webhooks/:id":{"description":"Delete a subscription. Requires write."}},"files":{"basePath":"/api/projects/:id/files","description":"File metadata and short-lived signed download URLs. Storage paths are never returned.","GET /api/projects/:id/files":{"description":"List project files. Query: page, limit (max 50)."},"GET /api/projects/:id/files/:fileId":{"description":"Get one project file and download_url."},"GET /api/contacts/:id/files":{"description":"List contact file attachments. download_url only when a stored file is linked."}},"agent":{"basePath":"/api/agent","description":"Intent API for AI assistants. Workspace comes from the API key. Look up by email, slug, exact name, or UUID. Mutating routes require an Idempotency-Key header. OpenAPI: GET /api/agent/openapi.json.","POST /api/agent/contacts":{"description":"Create a contact. Body: { name or first_name/last_name, email?, phone?, company? }. Duplicate email is refused. Requires write and Idempotency-Key."},"POST /api/agent/companies":{"description":"Create a company. Body: { name, email?, phone?, website? }. Requires write and Idempotency-Key."},"POST /api/agent/deals":{"description":"Create a deal. Body: { name, value?, status?, contact?, company? }. Requires write and Idempotency-Key."},"POST /api/agent/find":{"description":"Find one contact, company, deal, pipeline, or list. Body: { type, query }. Requires read."},"POST /api/agent/notes":{"description":"Log a note. Body: { contact, body }. Requires write and Idempotency-Key."},"POST /api/agent/tasks":{"description":"Create a task. Body: { title, contact?, due_date?, assignee? }. Requires write and Idempotency-Key."},"POST /api/agent/pipeline-cards/move":{"description":"Move a card to a stage by name. Body: { pipeline, card, stage }. Requires write and Idempotency-Key."},"POST /api/agent/lists/members":{"description":"Add a contact to a list. Body: { list, contact }. Requires write and Idempotency-Key."},"POST /api/agent/tags":{"description":"Assign a tag by name. Body: { contact, tag }. Requires write and Idempotency-Key."},"PATCH /api/agent/records":{"description":"Update scalar fields. Body: { type, query, name?, email?, phone?, status?, value? }. Contact, company, or deal. Requires write and Idempotency-Key."}}},"errorCodes":{"MISSING_API_KEY":"API key not provided in Authorization header","INVALID_API_KEY_FORMAT":"API key format is invalid","INVALID_API_KEY":"API key is invalid or inactive","EXPIRED_API_KEY":"API key has expired","RATE_LIMIT_EXCEEDED":"Rate limit exceeded","INSUFFICIENT_PERMISSIONS":"API key lacks required permissions","VALIDATION_ERROR":"Request validation failed","DUPLICATE_EMAIL":"Contact with this email already exists","CONTACT_NOT_FOUND":"Contact not found","META_TAG_NOT_FOUND":"Meta tag not found in this workspace","CUSTOM_FIELD_NOT_FOUND":"Custom field definition not found","FORM_NOT_FOUND":"Form not found in this workspace","SUBMISSION_NOT_FOUND":"Form submission not found","BOOKING_NOT_FOUND":"Booking not found","WEBHOOK_NOT_FOUND":"Webhook subscription not found","FILE_NOT_FOUND":"File not found","UNKNOWN_EVENT":"Webhook event type is not recognized","COMPANY_NOT_FOUND":"Company not found","META_TAGS_NOT_FOUND":"One or more meta tag IDs are not in this workspace","INVALID_META_TAG_ID":"A meta tag id is not a UUID","UNKNOWN_FIELDS":"Request body contains fields this endpoint does not accept","METHOD_NOT_ALLOWED":"HTTP method not allowed for this endpoint","INTERNAL_ERROR":"Internal server error","IDEMPOTENCY_KEY_REQUIRED":"Mutating Agent API calls must send Idempotency-Key","IDEMPOTENCY_CONFLICT":"Idempotency-Key was already used for a different request","IDEMPOTENCY_IN_PROGRESS":"Idempotency-Key is still running","AMBIGUOUS":"More than one record matched. Pass an email, slug, or id","NOT_FOUND":"No record matched the query"},"examples":{"listContacts":{"request":{"method":"GET","url":"/api/contacts?page=1&limit=10&search=john","headers":{"Authorization":"Bearer np_your_api_key_here"}},"response":{"status":200,"body":{"data":[{"id":"uuid-here","first_name":"John","last_name":"Doe","email":"john@example.com","phone":"+1234567890","status":"Active","created_at":"2024-01-01T00:00:00Z"}],"pagination":{"page":1,"limit":10,"total":1,"pages":1}}}},"createContact":{"request":{"method":"POST","url":"/api/contacts","headers":{"Authorization":"Bearer np_your_api_key_here","Content-Type":"application/json"},"body":{"first_name":"Jane","last_name":"Smith","email":"jane@example.com","phone":"+1234567890","status":"Active","fields":{"company":"Acme Corp","title":"Manager"}}},"response":{"status":201,"body":{"data":{"id":"uuid-here","first_name":"Jane","last_name":"Smith","email":"jane@example.com","created_at":"2024-01-01T00:00:00Z"},"message":"Contact created successfully"}}},"listContactActivities":{"request":{"method":"GET","url":"/api/contacts/CONTACT_UUID/activities?page=1&limit=50&type=note,task","headers":{"Authorization":"Bearer np_your_api_key_here"}},"response":{"status":200,"body":{"data":[],"pagination":{"page":1,"limit":50,"total":0,"pages":0},"meta":{"contact_id":"CONTACT_UUID","workspace_id":"WORKSPACE_UUID"}}}},"createContactNote":{"request":{"method":"POST","url":"/api/contacts/CONTACT_UUID/activities","headers":{"Authorization":"Bearer np_your_api_key_here","Content-Type":"application/json"},"body":{"type":"note","title":"Follow-up","content":"Called the customer; send proposal next week.","date":"2026-04-20T12:00:00.000Z"}},"response":{"status":201,"body":{"data":{"id":"uuid-here","type":"note","title":"Follow-up"},"message":"Note created successfully"}}},"createContactTask":{"request":{"method":"POST","url":"/api/contacts/CONTACT_UUID/activities","headers":{"Authorization":"Bearer np_your_api_key_here","Content-Type":"application/json"},"body":{"type":"task","title":"Send proposal","description":"Include pricing tier B","status":"To Do","priority":"High","due_date":"2026-04-25","assignees":[]}},"response":{"status":201,"body":{"data":{"activity":{"id":"uuid-here","type":"task"},"task":{"id":"uuid-here","title":"Send proposal","settings_json":{"contact_activity_id":"uuid-here"}}},"message":"Task and activity created successfully"}}}},"sdkExamples":{"javascript":{"description":"Using fetch in JavaScript","code":"\n// List contacts\nconst response = await fetch('http://localhost:3001/api/contacts', {\n  headers: {\n    'Authorization': 'Bearer np_your_api_key_here'\n  }\n});\nconst contacts = await response.json();\n\n// Create contact\nconst newContact = await fetch('http://localhost:3001/api/contacts', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer np_your_api_key_here',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\n    first_name: 'John',\n    last_name: 'Doe',\n    email: 'john@example.com'\n  })\n});\n\n// List contact activities (timeline)\nconst activities = await fetch(\n  'http://localhost:3001/api/contacts/CONTACT_UUID/activities?type=note,task',\n  { headers: { 'Authorization': 'Bearer np_your_api_key_here' } }\n);\n        "},"python":{"description":"Using requests in Python","code":"\nimport requests\n\nheaders = {'Authorization': 'Bearer np_your_api_key_here'}\n\n# List contacts\nresponse = requests.get('http://localhost:3001/api/contacts', headers=headers)\ncontacts = response.json()\n\n# Create contact\nnew_contact = requests.post('http://localhost:3001/api/contacts', \n  headers=headers,\n  json={\n    'first_name': 'John',\n    'last_name': 'Doe',\n    'email': 'john@example.com'\n  }\n)\n\n# Contact timeline activities\nr = requests.get(\n  'http://localhost:3001/api/contacts/CONTACT_UUID/activities',\n  headers=headers,\n  params={'type': 'note,task', 'limit': 50}\n)\n        "},"curl":{"description":"Using curl","code":"\n# List contacts\ncurl -H \"Authorization: Bearer np_your_api_key_here\" \\\n  http://localhost:3001/api/contacts\n\n# Create contact\ncurl -X POST \\\n  -H \"Authorization: Bearer np_your_api_key_here\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"first_name\":\"John\",\"last_name\":\"Doe\",\"email\":\"john@example.com\"}' \\\n  http://localhost:3001/api/contacts\n\n# List contact timeline activities (notes & tasks)\ncurl -H \"Authorization: Bearer np_your_api_key_here\" \\\n  \"http://localhost:3001/api/contacts/CONTACT_UUID/activities?type=note,task&limit=50\"\n\n# Create a note on the contact timeline\ncurl -X POST \\\n  -H \"Authorization: Bearer np_your_api_key_here\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"type\":\"note\",\"title\":\"Follow-up\",\"content\":\"Notes here\"}' \\\n  http://localhost:3001/api/contacts/CONTACT_UUID/activities\n        "}}}