# Companies ## List all companies **get** `/v2/companies` Returns all companies in your organization with cursor-based pagination. ### Query Parameters - `limit` - Number of companies to return (1-100, default: 10) - `cursor` - Opaque cursor from a previous response for pagination ### Response Structure The response includes: - `object` - Always "list" - `data` - Array of company objects - `nextCursor` - Cursor for the next page (null if no more results) ### Company Object Each company includes: - `id` - Featurebase internal ID (MongoDB ObjectId) - `companyId` - External company ID from your system - `name` - Company name - `monthlySpend` - Monthly spend/revenue - `industry` - Industry - `website` - Company website URL - `plan` - Plan/tier name - `linkedUsers` - Number of users linked to this company - `companySize` - Employee headcount - `lastActivity` - Last activity timestamp - `customFields` - Custom field values - `createdAt` - Creation timestamp - `updatedAt` - Last update timestamp ### Example Response ```json { "object": "list", "data": [ { "object": "company", "id": "507f1f77bcf86cd799439011", "companyId": "comp_12345", "name": "Acme Inc", "monthlySpend": 5000, "industry": "Technology", "website": "https://acme.com", "plan": "enterprise", "linkedUsers": 15, "companySize": 250, "lastActivity": "2025-01-15T00:00:00.000Z", "customFields": { "location": "Europe" }, "createdAt": "2025-01-01T12:00:00.000Z", "updatedAt": "2025-01-10T15:30:00.000Z" } ], "nextCursor": "eyJpZCI6IjUwN2YxZjc3YmNmODZjZDc5OTQzOTAxMSJ9" } ``` ### Version Availability This endpoint is only available in API version 2026-01-01.nova and newer. ### Query Parameters - `cursor: optional string` An opaque cursor for pagination. Use the nextCursor value from a previous response to fetch the next page of results. - `limit: optional number` A limit on the number of companies to be returned, between 1 and 100. ### Header Parameters - `"Featurebase-Version": optional "2026-01-01.nova" or "2025-12-12.clover"` - `"2026-01-01.nova"` - `"2025-12-12.clover"` ### Returns - `data: array of Company` Array of companies - `id: string` Featurebase internal ID - `companyId: string` External company ID from your system - `companySize: number` Company employee headcount - `createdAt: string` ISO date when company was created - `industry: string` Industry - `lastActivity: string` ISO date of last activity - `linkedUsers: number` Number of users linked to this company - `monthlySpend: number` Monthly spend - `name: string` Company name - `object: "company"` Object type identifier - `"company"` - `plan: string` Plan or tier name - `updatedAt: string` ISO date when company was last updated - `website: string` Company website URL - `customFields: optional map[unknown]` Custom field values - `nextCursor: string` Cursor for fetching the next page (cursor-based pagination) - `object: "list"` Object type identifier - `"list"` ### Example ```http curl https://do.featurebase.app/v2/companies \ -H "Authorization: Bearer $FEATUREBASE_API_KEY" ``` #### Response ```json { "data": [ { "id": "507f1f77bcf86cd799439011", "companyId": "comp_12345", "companySize": 250, "createdAt": "2025-01-01T12:00:00.000Z", "industry": "Technology", "lastActivity": "2025-01-15T00:00:00.000Z", "linkedUsers": 15, "monthlySpend": 5000, "name": "Acme Inc", "object": "company", "plan": "enterprise", "updatedAt": "2025-01-10T15:30:00.000Z", "website": "https://acme.com", "customFields": { "location": "bar", "priority": "bar" } } ], "nextCursor": "eyJpZCI6IjUwN2YxZjc3YmNmODZjZDc5OTQzOTAxMSJ9", "object": "list" } ``` ## Create or update a company **post** `/v2/companies` Creates a new company or updates an existing one. Uses the external `companyId` as the unique identifier for upsert matching. If a company with the given `companyId` already exists, it will be updated. Otherwise, a new company will be created. ### Request Body | Field | Type | Required | Description | | -------------- | ------ | -------- | -------------------------------------------------------- | | `companyId` | string | Yes | External company ID from your system (unique identifier) | | `name` | string | Yes | Company name | | `monthlySpend` | number | No | Monthly spend/revenue from this company | | `industry` | string | No | Industry the company operates in | | `website` | string | No | Company website URL | | `plan` | string | No | Current plan/subscription name | | `companySize` | number | No | Number of employees | | `createdAt` | string | No | When the company was created (ISO 8601) | | `customFields` | object | No | Custom field values | ### Example Request ```json { "companyId": "comp_12345", "name": "Acme Inc", "monthlySpend": 5000, "industry": "Technology", "website": "https://acme.com", "plan": "enterprise", "companySize": 250, "customFields": { "region": "EMEA", "tier": "gold" } } ``` ### Example Response ```json { "object": "company", "id": "507f1f77bcf86cd799439011", "companyId": "comp_12345", "name": "Acme Inc", "monthlySpend": 5000, "industry": "Technology", "website": "https://acme.com", "plan": "enterprise", "linkedUsers": 1, "companySize": 250, "lastActivity": "2025-01-15T00:00:00.000Z", "customFields": { "region": "EMEA", "tier": "gold" }, "createdAt": "2025-01-01T12:00:00.000Z", "updatedAt": "2025-01-15T10:30:00.000Z" } ``` ### Error Responses - **400 Bad Request** - Invalid company data ### Version Availability This endpoint is only available in API version 2026-01-01.nova and newer. ### Header Parameters - `"Featurebase-Version": optional "2026-01-01.nova" or "2025-12-12.clover"` - `"2026-01-01.nova"` - `"2025-12-12.clover"` ### Body Parameters - `companyId: string` External company ID from your system. Used as the unique identifier for upsert matching. - `name: string` Company name - `companySize: optional number` Number of employees in the company - `createdAt: optional string` When the company was created in your system (ISO 8601) - `customFields: optional object { priority, region, tier }` Custom field values on the company. Values can be string, number, boolean, null, or array of primitives. - `priority: optional string` - `region: optional string` - `tier: optional string` - `industry: optional string` Industry the company operates in - `monthlySpend: optional number` Monthly spend/revenue from this company - `plan: optional string` Current plan/subscription name - `website: optional string` Company website URL ### Returns - `Company object { id, companyId, companySize, 11 more }` - `id: string` Featurebase internal ID - `companyId: string` External company ID from your system - `companySize: number` Company employee headcount - `createdAt: string` ISO date when company was created - `industry: string` Industry - `lastActivity: string` ISO date of last activity - `linkedUsers: number` Number of users linked to this company - `monthlySpend: number` Monthly spend - `name: string` Company name - `object: "company"` Object type identifier - `"company"` - `plan: string` Plan or tier name - `updatedAt: string` ISO date when company was last updated - `website: string` Company website URL - `customFields: optional map[unknown]` Custom field values ### Example ```http curl https://do.featurebase.app/v2/companies \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $FEATUREBASE_API_KEY" \ -d '{ "companyId": "comp_12345", "name": "Acme Inc", "companySize": 250, "createdAt": "2024-01-15T10:30:00Z", "industry": "Technology", "monthlySpend": 5000, "plan": "enterprise", "website": "https://acme.com" }' ``` #### Response ```json { "id": "507f1f77bcf86cd799439011", "companyId": "comp_12345", "companySize": 250, "createdAt": "2025-01-01T12:00:00.000Z", "industry": "Technology", "lastActivity": "2025-01-15T00:00:00.000Z", "linkedUsers": 15, "monthlySpend": 5000, "name": "Acme Inc", "object": "company", "plan": "enterprise", "updatedAt": "2025-01-10T15:30:00.000Z", "website": "https://acme.com", "customFields": { "location": "bar", "priority": "bar" } } ``` ## Get company by ID **get** `/v2/companies/{id}` Retrieves a single company by its Featurebase ID. ### Path Parameters - `id` - The Featurebase internal ID of the company (MongoDB ObjectId) ### Response Returns a company object with: - `id` - Featurebase internal ID - `companyId` - External company ID from your system - `name` - Company name - `monthlySpend` - Monthly spend/revenue - `industry` - Industry - `website` - Company website URL - `plan` - Plan/tier name - `linkedUsers` - Number of users linked to this company - `companySize` - Employee headcount - `lastActivity` - Last activity timestamp - `customFields` - Custom field values - `createdAt` - Creation timestamp - `updatedAt` - Last update timestamp ### Example Response ```json { "object": "company", "id": "507f1f77bcf86cd799439011", "companyId": "comp_12345", "name": "Acme Inc", "monthlySpend": 5000, "industry": "Technology", "website": "https://acme.com", "plan": "enterprise", "linkedUsers": 15, "companySize": 250, "lastActivity": "2025-01-15T00:00:00.000Z", "customFields": { "location": "Europe" }, "createdAt": "2025-01-01T12:00:00.000Z", "updatedAt": "2025-01-10T15:30:00.000Z" } ``` ### Error Responses - **404 Not Found** - Company with the specified ID does not exist ### Version Availability This endpoint is only available in API version 2026-01-01.nova and newer. ### Path Parameters - `id: string` The Featurebase internal ID of the company (MongoDB ObjectId) ### Header Parameters - `"Featurebase-Version": optional "2026-01-01.nova" or "2025-12-12.clover"` - `"2026-01-01.nova"` - `"2025-12-12.clover"` ### Returns - `Company object { id, companyId, companySize, 11 more }` - `id: string` Featurebase internal ID - `companyId: string` External company ID from your system - `companySize: number` Company employee headcount - `createdAt: string` ISO date when company was created - `industry: string` Industry - `lastActivity: string` ISO date of last activity - `linkedUsers: number` Number of users linked to this company - `monthlySpend: number` Monthly spend - `name: string` Company name - `object: "company"` Object type identifier - `"company"` - `plan: string` Plan or tier name - `updatedAt: string` ISO date when company was last updated - `website: string` Company website URL - `customFields: optional map[unknown]` Custom field values ### Example ```http curl https://do.featurebase.app/v2/companies/$ID \ -H "Authorization: Bearer $FEATUREBASE_API_KEY" ``` #### Response ```json { "id": "507f1f77bcf86cd799439011", "companyId": "comp_12345", "companySize": 250, "createdAt": "2025-01-01T12:00:00.000Z", "industry": "Technology", "lastActivity": "2025-01-15T00:00:00.000Z", "linkedUsers": 15, "monthlySpend": 5000, "name": "Acme Inc", "object": "company", "plan": "enterprise", "updatedAt": "2025-01-10T15:30:00.000Z", "website": "https://acme.com", "customFields": { "location": "bar", "priority": "bar" } } ``` ## Delete a company **delete** `/v2/companies/{id}` Deletes a company by its Featurebase ID. This will also remove the company from all linked users' associations. ### Path Parameters - `id` - The Featurebase internal ID of the company (MongoDB ObjectId) ### Response Returns a deletion confirmation object: ```json { "id": "507f1f77bcf86cd799439011", "object": "company", "deleted": true } ``` ### Error Responses - **404 Not Found** - Company with the specified ID does not exist ### Version Availability This endpoint is only available in API version 2026-01-01.nova and newer. ### Path Parameters - `id: string` The Featurebase internal ID of the company (MongoDB ObjectId) ### Header Parameters - `"Featurebase-Version": optional "2026-01-01.nova" or "2025-12-12.clover"` - `"2026-01-01.nova"` - `"2025-12-12.clover"` ### Returns - `DeletedCompany object { id, deleted, object }` - `id: string` Unique identifier of the deleted company - `deleted: true` Indicates the resource was deleted - `true` - `object: "company"` Object type identifier - `"company"` ### Example ```http curl https://do.featurebase.app/v2/companies/$ID \ -X DELETE \ -H "Authorization: Bearer $FEATUREBASE_API_KEY" ``` #### Response ```json { "id": "507f1f77bcf86cd799439011", "deleted": true, "object": "company" } ``` ## Delete a company by external company ID **delete** `/v2/companies/by-company-id/{companyId}` Permanently deletes a company by its external company ID (the `companyId` from your system). This will also remove the company from all linked users' associations. ### Path Parameters - `companyId` - The external company ID from your system ### Deletion Behavior When a company is deleted: - The company record is permanently removed - The company is removed from all linked users' `companyIds` and `companies` arrays ### Response Returns a deletion confirmation object: - `id` - The Featurebase internal ID of the deleted company - `object` - Always "company" - `deleted` - Always `true` ### Example Response ```json { "id": "507f1f77bcf86cd799439011", "object": "company", "deleted": true } ``` ### Use Case Use this endpoint when you need to delete a company using your own system's company identifier, such as when a company is removed from your application. ### Version Availability This endpoint is only available in API version 2026-01-01.nova and newer. ### Path Parameters - `companyId: string` The external company ID from your system ### Header Parameters - `"Featurebase-Version": optional "2026-01-01.nova" or "2025-12-12.clover"` - `"2026-01-01.nova"` - `"2025-12-12.clover"` ### Returns - `DeletedCompany object { id, deleted, object }` - `id: string` Unique identifier of the deleted company - `deleted: true` Indicates the resource was deleted - `true` - `object: "company"` Object type identifier - `"company"` ### Example ```http curl https://do.featurebase.app/v2/companies/by-company-id/$COMPANY_ID \ -X DELETE \ -H "Authorization: Bearer $FEATUREBASE_API_KEY" ``` #### Response ```json { "id": "507f1f77bcf86cd799439011", "deleted": true, "object": "company" } ``` ## Domain Types ### Company - `Company object { id, companyId, companySize, 11 more }` - `id: string` Featurebase internal ID - `companyId: string` External company ID from your system - `companySize: number` Company employee headcount - `createdAt: string` ISO date when company was created - `industry: string` Industry - `lastActivity: string` ISO date of last activity - `linkedUsers: number` Number of users linked to this company - `monthlySpend: number` Monthly spend - `name: string` Company name - `object: "company"` Object type identifier - `"company"` - `plan: string` Plan or tier name - `updatedAt: string` ISO date when company was last updated - `website: string` Company website URL - `customFields: optional map[unknown]` Custom field values ### Deleted Company - `DeletedCompany object { id, deleted, object }` - `id: string` Unique identifier of the deleted company - `deleted: true` Indicates the resource was deleted - `true` - `object: "company"` Object type identifier - `"company"` # Contacts ## List contacts attached to a company **get** `/v2/companies/{id}/contacts` Returns all contacts (customers) attached to a specific company. Only returns contacts with type "customer" that have the company in their `companyIds` array. Uses cursor-based pagination. ### Path Parameters - `id` - The Featurebase internal ID of the company (MongoDB ObjectId) ### Query Parameters - `limit` - Number of contacts to return (1-100, default: 10) - `cursor` - Opaque cursor from a previous response for pagination ### Response Structure The response includes: - `object` - Always "list" - `data` - Array of contact objects - `nextCursor` - Cursor for the next page (null if no more results) ### Example Response ```json { "object": "list", "data": [ { "object": "contact", "id": "507f1f77bcf86cd799439011", "userId": "usr_12345", "email": "john@acme.com", "name": "John Doe", "type": "customer", "companies": [...], "createdAt": "2025-01-01T12:00:00.000Z" } ], "nextCursor": "eyJpZCI6IjUwN2YxZjc3YmNmODZjZDc5OTQzOTAxMSJ9" } ``` ### Error Responses - **404 Not Found** - Company with the specified ID does not exist ### Version Availability This endpoint is only available in API version 2026-01-01.nova and newer. ### Path Parameters - `id: string` The Featurebase internal ID of the company (MongoDB ObjectId) ### Query Parameters - `cursor: optional string` An opaque cursor for pagination. Use the nextCursor value from a previous response to fetch the next page of results. - `limit: optional number` A limit on the number of contacts to be returned, between 1 and 100. ### Header Parameters - `"Featurebase-Version": optional "2026-01-01.nova" or "2025-12-12.clover"` - `"2026-01-01.nova"` - `"2025-12-12.clover"` ### Returns - `ContactList object { data, nextCursor, object }` - `data: array of Contact` Array of contacts - `nextCursor: string` Cursor for fetching the next page (cursor-based pagination) - `object: "list"` Object type identifier - `"list"` ### Example ```http curl https://do.featurebase.app/v2/companies/$ID/contacts \ -H "Authorization: Bearer $FEATUREBASE_API_KEY" ``` #### Response ```json { "data": [ { "id": "676f0f6765bdaa7d7d760f88", "name": "John Steezy", "object": "contact", "type": "customer", "commentsCreated": 0, "companies": [ { "id": "507f1f77bcf86cd799439011", "companyId": "comp_12345", "companySize": 250, "createdAt": "2025-01-01T12:00:00.000Z", "industry": "Technology", "lastActivity": "2025-01-15T00:00:00.000Z", "linkedUsers": 15, "monthlySpend": 5000, "name": "Acme Inc", "object": "company", "plan": "enterprise", "updatedAt": "2025-01-10T15:30:00.000Z", "website": "https://acme.com", "customFields": { "location": "bar", "priority": "bar" } } ], "customFields": { "foo": "bar" }, "description": "", "email": "john@example.com", "lastActivity": "2025-01-03T21:42:30.181Z", "locale": "en", "manuallyOptedOutFromChangelog": false, "organizationId": "5febde12dc56d60012d47db6", "postsCreated": 0, "profilePicture": "https://fb-usercontent.fra1.cdn.digitaloceanspaces.com/anon_23.png", "roles": [ "string" ], "subscribedToChangelog": true, "userId": "676f0f673dbb299c8a4f3057", "verified": true } ], "nextCursor": "eyJpZCI6IjUwN2YxZjc3YmNmODZjZDc5OTQzOTAxMSJ9", "object": "list" } ``` ## Attach a contact to a company **post** `/v2/companies/{id}/contacts` Attaches a contact (customer) to a company. Adds the company to the contact's `companyIds` array and embedded `companies` array. This operation is **additive** - existing company associations are preserved. Also increments the `linkedUsers` count on the company. ### Path Parameters - `id` - The Featurebase internal ID of the company (MongoDB ObjectId) ### Request Body | Field | Type | Required | Description | | ----------- | ------ | -------- | ----------------------------------------------------------------------- | | `contactId` | string | Yes | The Featurebase internal ID of the contact to attach (MongoDB ObjectId) | ### Example Request ```json { "contactId": "507f1f77bcf86cd799439012" } ``` ### Response Returns the updated contact object with the new company association. ### Example Response ```json { "object": "contact", "id": "507f1f77bcf86cd799439012", "userId": "usr_12345", "email": "john@acme.com", "name": "John Doe", "type": "customer", "companies": [ { "object": "company", "id": "507f1f77bcf86cd799439011", "companyId": "comp_12345", "name": "Acme Inc" } ] } ``` ### Error Responses - **404 Not Found** - Company or contact does not exist ### Version Availability This endpoint is only available in API version 2026-01-01.nova and newer. ### Path Parameters - `id: string` The Featurebase internal ID of the company (MongoDB ObjectId) ### Header Parameters - `"Featurebase-Version": optional "2026-01-01.nova" or "2025-12-12.clover"` - `"2026-01-01.nova"` - `"2025-12-12.clover"` ### Body Parameters - `contactId: string` The Featurebase internal ID of the contact to attach (MongoDB ObjectId) ### Example ```http curl https://do.featurebase.app/v2/companies/$ID/contacts \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $FEATUREBASE_API_KEY" \ -d '{ "contactId": "507f1f77bcf86cd799439012" }' ``` #### Response ```json { "id": "676f0f6765bdaa7d7d760f88", "name": "John Steezy", "object": "contact", "type": "customer", "commentsCreated": 0, "companies": [ { "id": "507f1f77bcf86cd799439011", "companyId": "comp_12345", "companySize": 250, "createdAt": "2025-01-01T12:00:00.000Z", "industry": "Technology", "lastActivity": "2025-01-15T00:00:00.000Z", "linkedUsers": 15, "monthlySpend": 5000, "name": "Acme Inc", "object": "company", "plan": "enterprise", "updatedAt": "2025-01-10T15:30:00.000Z", "website": "https://acme.com", "customFields": { "location": "bar", "priority": "bar" } } ], "customFields": { "foo": "bar" }, "description": "", "email": "john@example.com", "lastActivity": "2025-01-03T21:42:30.181Z", "locale": "en", "manuallyOptedOutFromChangelog": false, "organizationId": "5febde12dc56d60012d47db6", "postsCreated": 0, "profilePicture": "https://fb-usercontent.fra1.cdn.digitaloceanspaces.com/anon_23.png", "roles": [ "string" ], "subscribedToChangelog": true, "userId": "676f0f673dbb299c8a4f3057", "verified": true } ``` ## Remove a contact from a company **delete** `/v2/companies/{id}/contacts/{contactId}` Removes a contact (customer) from a company. Removes the company from the contact's `companyIds` array and embedded `companies` array. Also decrements the `linkedUsers` count on the company. ### Path Parameters - `id` - The Featurebase internal ID of the company (MongoDB ObjectId) - `contactId` - The Featurebase internal ID of the contact to remove (MongoDB ObjectId) ### Response Returns the updated contact object with the company removed. ### Example Response ```json { "object": "contact", "id": "507f1f77bcf86cd799439012", "userId": "usr_12345", "email": "john@acme.com", "name": "John Doe", "type": "customer", "companies": [] } ``` ### Error Responses - **400 Bad Request** - Contact is not attached to this company - **404 Not Found** - Company or contact does not exist ### Version Availability This endpoint is only available in API version 2026-01-01.nova and newer. ### Path Parameters - `id: string` The Featurebase internal ID of the company (MongoDB ObjectId) - `contactId: string` The Featurebase internal ID of the contact to remove (MongoDB ObjectId) ### Header Parameters - `"Featurebase-Version": optional "2026-01-01.nova" or "2025-12-12.clover"` - `"2026-01-01.nova"` - `"2025-12-12.clover"` ### Example ```http curl https://do.featurebase.app/v2/companies/$ID/contacts/$CONTACT_ID \ -X DELETE \ -H "Authorization: Bearer $FEATUREBASE_API_KEY" ``` #### Response ```json { "id": "676f0f6765bdaa7d7d760f88", "name": "John Steezy", "object": "contact", "type": "customer", "commentsCreated": 0, "companies": [ { "id": "507f1f77bcf86cd799439011", "companyId": "comp_12345", "companySize": 250, "createdAt": "2025-01-01T12:00:00.000Z", "industry": "Technology", "lastActivity": "2025-01-15T00:00:00.000Z", "linkedUsers": 15, "monthlySpend": 5000, "name": "Acme Inc", "object": "company", "plan": "enterprise", "updatedAt": "2025-01-10T15:30:00.000Z", "website": "https://acme.com", "customFields": { "location": "bar", "priority": "bar" } } ], "customFields": { "foo": "bar" }, "description": "", "email": "john@example.com", "lastActivity": "2025-01-03T21:42:30.181Z", "locale": "en", "manuallyOptedOutFromChangelog": false, "organizationId": "5febde12dc56d60012d47db6", "postsCreated": 0, "profilePicture": "https://fb-usercontent.fra1.cdn.digitaloceanspaces.com/anon_23.png", "roles": [ "string" ], "subscribedToChangelog": true, "userId": "676f0f673dbb299c8a4f3057", "verified": true } ``` ## Domain Types ### Contact Attach Response - `ContactAttachResponse = Contact` User who submitted the response ### Contact Remove Response - `ContactRemoveResponse = Contact` User who submitted the response