> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.houseofapps.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.houseofapps.ai/_mcp/server.

# Create a company

POST https://api-dev.houseofapps.ai/v1/integrations/clients/companies
Content-Type: application/json

Creates a company. `name` is required.

Reference: https://docs.houseofapps.ai/api-reference/overview/crm/companies/external-create-company-v-1-integrations-clients-companies-post

## Request

### Headers

- `licenseKey` (string, required)
- `appSecret` (string, required)

### Body (application/json)

This endpoint expects a CreateCompanyRequest.

- `name` (string, required)
- `owner_id` (string, optional, nullable) — Owning user; defaults to the caller on internal create when omitted.
- `industry` (string, optional, nullable)
- `profile_photo_url` (string, optional, nullable)
- `portal_access` (boolean, optional, default: false)
- `email` (string, optional, nullable)
- `phones` (list of Phone, optional)
- `tags` (list of string, optional)
- `websites` (list of Website, optional)
- `billing_preferences` (BillingPreferences, optional, nullable) — Billing preferences (defaults to empty preferences).
- `social_pages` (list of SocialPage, optional)
- `target_market_segments` (list of string, optional)
- `current_tech_stack` (list of string, optional)
- `preferred_communication_channels` (list of string, optional)
- `industry_specific_terminologies` (list of string, optional)
- `description` (string, optional, nullable)
- `custom_fields` (list of map from string to any, optional)
- `additional_data` (map from string to any, optional)
- `notes` (list of NoteItemInput, optional) — Structured notes
- `lead` (CompanyLeadAssociation, optional, nullable) — Optional lead creation. When provided, creates a lead and associates it with this company (and the linked contact if provided).
- `contact_association` (CompanyContactsCreate, optional, nullable) — Optional contact association (add existing OR create+associate).
- `addresses` (list of AddressInput, optional)

## Response

### 201

Created

- `status` (string, required) — Response status
- `message` (string, required) — Human-readable success message
- `statusCode` (integer, required) — HTTP status code
- `code` (string, required) — Custom application status code
- `data` (SuccessResponseData, optional, nullable) — Payload for this endpoint

## Errors

### 400 Bad Request Error

Bad Request

- `status` (string, required) — Response status
- `message` (string, required) — Human-readable error message
- `statusCode` (integer, required) — HTTP status code
- `code` (string, required) — Custom application status code
- `messageKey` (string, optional) — i18n key for the message
- `errors` (list of map from string to any, optional) — Optional field-level validation errors

### 401 Unauthorized Error

Unauthorized

- `status` (string, required) — Response status
- `message` (string, required) — Human-readable error message
- `statusCode` (integer, required) — HTTP status code
- `code` (string, required) — Custom application status code
- `messageKey` (string, optional) — i18n key for the message
- `errors` (list of map from string to any, optional) — Optional field-level validation errors

### 409 Conflict Error

Conflict

- `status` (string, required) — Response status
- `message` (string, required) — Human-readable error message
- `statusCode` (integer, required) — HTTP status code
- `code` (string, required) — Custom application status code
- `messageKey` (string, optional) — i18n key for the message
- `errors` (list of map from string to any, optional) — Optional field-level validation errors

### 422 Unprocessable Entity Error

Unprocessable Entity

- `status` (string, required) — Response status
- `message` (string, required) — Human-readable error message
- `statusCode` (integer, required) — HTTP status code
- `code` (string, required) — Custom application status code
- `messageKey` (string, optional) — i18n key for the message
- `errors` (list of map from string to any, optional) — Optional field-level validation errors

### 429 Too Many Requests Error

Too Many Requests

- `status` (string, required) — Response status
- `message` (string, required) — Human-readable error message
- `statusCode` (integer, required) — HTTP status code
- `code` (string, required) — Custom application status code
- `messageKey` (string, optional) — i18n key for the message
- `errors` (list of map from string to any, optional) — Optional field-level validation errors

### 500 Internal Server Error

Internal Server Error

- `status` (string, required) — Response status
- `message` (string, required) — Human-readable error message
- `statusCode` (integer, required) — HTTP status code
- `code` (string, required) — Custom application status code
- `messageKey` (string, optional) — i18n key for the message
- `errors` (list of map from string to any, optional) — Optional field-level validation errors

### 503 Service Unavailable Error

Service Unavailable

- `status` (string, required) — Response status
- `message` (string, required) — Human-readable error message
- `statusCode` (integer, required) — HTTP status code
- `code` (string, required) — Custom application status code
- `messageKey` (string, optional) — i18n key for the message
- `errors` (list of map from string to any, optional) — Optional field-level validation errors

## Types

### Phone

Phone number item: id, phone_number, phone_isd_code, label, is_primary.

- `phone_number` (string, required) — Phone number
- `phone_isd_code` (string, required) — Phone ISD code
- `id` (string, optional, nullable) — Phone item ID
- `label` (string, optional, nullable) — Label (e.g. mobile, work)
- `is_primary` (boolean, optional, default: false) — Primary phone flag

### Website

Website schema.

- `url` (string, required) — Website URL
- `type` (string, required) — Website type
- `id` (string, optional, nullable) — Website ID
- `is_primary` (boolean, optional, default: false) — Primary website flag

### BillingPreferences

Billing preferences schema.

- `method` (string, optional, nullable) — Billing method
- `terms` (string, optional, nullable) — Payment terms

### SocialPage

Social media page schema: platform (e.g. linkedin, instagram, twitter) and URL.

- `platform` (string, required) — Platform name
- `url` (string, required) — Profile/page URL
- `id` (string, optional, nullable) — Social page ID

### NoteItemInput

Client input for a structured note (title and content only).

- `title` (string, required)
- `content` (string, required)

### CompanyLeadAssociation

Optional lead creation/linking on company create. Creates a new lead (v2 `public.leads`) and associates it with the created company, and also with the linked/created contact when present on the same request.

- `stage_id` (string, required) — Lead pipeline stage id (UUID).
- `intake_stage` (string, optional, nullable) — Optional intake stage label.
- `lead_score` (string, optional, nullable) — Optional lead score label/tier.

### CompanyContactsCreate

Contact association payload used during company create. Mirrors the update naming, but allows only a single operation: - add an existing contact membership (optional primary) - OR create exactly one new contact and associate it (optional primary)

- `add_association` (CompanyContactAssociationAdd, optional, nullable) — Associate an existing contact to this company (single).
- `create_and_associate` (CompanyContactAssociationCreate, optional, nullable) — Create exactly one new contact and associate it to the company (single).

### AddressInput

Address input for add operation.

- `place_id` (string, optional, nullable)
- `address_line1` (string, optional, nullable) — Primary address line
- `address_line2` (string, optional, nullable)
- `city` (string, optional, nullable)
- `state` (string, optional, nullable)
- `postal_code` (string, optional, nullable)
- `country` (string, optional, nullable)
- `latitude` (double, optional, nullable)
- `longitude` (double, optional, nullable)
- `address_type` (enum, optional, nullable) — Address type enumeration.
  - Allowed values: `work`, `home`, `billing`, `shipping`, `other`
- `address_data` (map from string to any, optional) — Extra address metadata (e.g. formatted line). Defaults to when omitted.
- `is_primary` (boolean, optional, default: false) — Primary address flag

### SuccessResponseData

Payload for this endpoint

- map from string to any
- list of any
- string
- double
- boolean

### CompanyContactAssociationAdd

Add an existing contact membership for a company.

- `contact_id` (string, required) — Existing contact id to link
- `is_primary` (boolean, optional, default: false) — If true, set this contact as the company's primary contact.

### CompanyContactAssociationCreate

Create exactly one new contact and link it to the company.

- `contact` (CreateContactRequest, required) — New contact payload (same shape as POST /contacts).
- `is_primary` (boolean, optional, default: false) — If true, set the new contact as the company's primary contact.

### CreateContactRequest

Create a contact. Supports the operations from ADR: - contact only - contact + link to existing company (optionally primary) - contact + create new company + link (optionally primary)

- `email` (string, required) — Contact email address (required).
- `owner_id` (string, optional, nullable) — Owning user; defaults to the caller on internal create when omitted.
- `portal_access` (boolean, optional, default: false) — If true, provisions a portal user for this contact and sends an invite email.
- `prefix` (string, optional, nullable)
- `first_name` (string, optional, nullable)
- `middle_name` (string, optional, nullable)
- `last_name` (string, optional, nullable)
- `title` (string, optional, nullable)
- `date_of_birth` (date, optional, nullable)
- `profile_photo_url` (string, optional, nullable)
- `external_contact_id` (string, optional, nullable) — Optional identifier from an external system (immutable after create).
- `phones` (list of PhoneInput, optional)
- `tags` (list of string, optional)
- `social_pages` (list of SocialPage, optional)
- `websites` (list of Website, optional) — Websites for the contact (stored in additional_data.websites).
- `custom_fields` (list of map from string to any, optional) — Custom fields root cells payload (validated and stored as JSONB).
- `additional_data` (map from string to any, optional) — Free-form JSONB payload stored on the contact.
- `notes` (list of NoteItemInput, optional) — Structured notes
- `lead` (ContactLeadAssociation, optional, nullable) — Optional lead creation. When provided, creates a lead and associates it with this contact (and the linked company if provided).
- `company_association` (ContactCompaniesCreate, optional, nullable) — Optional company association (add existing OR create+associate).
- `addresses` (list of AddressInput, optional)

### PhoneInput

Phone input for add operation (no id).

- `phone_number` (string, required) — Phone number
- `phone_isd_code` (string, required) — Phone ISD code
- `label` (string, optional, nullable) — Label (e.g. mobile, work)
- `is_primary` (boolean, optional, default: false) — Primary phone flag

### ContactLeadAssociation

Optional lead creation/linking on contact create. This creates a new lead (v2 `public.leads`) and associates it with the created contact, and also with the linked/created company when present on the same request.

- `stage_id` (string, required) — Lead pipeline stage id (UUID).
- `name` (string, optional, nullable) — Optional lead display title. When omitted or blank, the lead name is derived from the contact first/last name (or email).
- `intake_stage` (string, optional, nullable) — Optional intake stage label.
- `lead_score` (string, optional, nullable) — Optional lead score label/tier.

### ContactCompaniesCreate

Company association payload used during contact create. Mirrors the update naming, but allows only a single operation: - add an existing company membership (optional primary) - OR create exactly one new company and associate it (optional primary)

- `add_association` (ContactCompanyAssociationAdd, optional, nullable) — Associate the contact with an existing company (single).
- `create_and_associate` (ContactCompanyAssociationCreateInline, optional, nullable) — Create exactly one new company and associate it to the contact (single).

### ContactCompanyAssociationAdd

Add an existing company membership for a contact.

- `company_id` (string, required) — Existing company id to link
- `is_primary` (boolean, optional, default: false) — If true, set this contact as the company's primary contact.

### ContactCompanyAssociationCreateInline

Create a new company inline and link it during contact create.

- `company` (CreateCompanyRequest, required) — New company payload (same shape as POST /companies).
- `is_primary` (boolean, optional, default: false) — If true, set this contact as the company's primary contact.

### CreateCompanyRequest

Create a company. Supports ADR operations: - company only - company + link existing contact (primary/non-primary) - company + create new contact + link (primary/non-primary)

- `name` (string, required)
- `owner_id` (string, optional, nullable) — Owning user; defaults to the caller on internal create when omitted.
- `industry` (string, optional, nullable)
- `profile_photo_url` (string, optional, nullable)
- `portal_access` (boolean, optional, default: false)
- `email` (string, optional, nullable)
- `phones` (list of Phone, optional)
- `tags` (list of string, optional)
- `websites` (list of Website, optional)
- `billing_preferences` (BillingPreferences, optional, nullable) — Billing preferences (defaults to empty preferences).
- `social_pages` (list of SocialPage, optional)
- `target_market_segments` (list of string, optional)
- `current_tech_stack` (list of string, optional)
- `preferred_communication_channels` (list of string, optional)
- `industry_specific_terminologies` (list of string, optional)
- `description` (string, optional, nullable)
- `custom_fields` (list of map from string to any, optional)
- `additional_data` (map from string to any, optional)
- `notes` (list of NoteItemInput, optional) — Structured notes
- `lead` (CompanyLeadAssociation, optional, nullable) — Optional lead creation. When provided, creates a lead and associates it with this company (and the linked contact if provided).
- `contact_association` (CompanyContactsCreate, optional, nullable) — Optional contact association (add existing OR create+associate).
- `addresses` (list of AddressInput, optional)

## Examples

**Request**

```json
{
  "name": "string"
}
```

**Response**

```json
{
  "status": "success",
  "message": "Company created successfully",
  "statusCode": 201,
  "code": "2001",
  "data": {
    "company_id": "co12b3c4-1111-2222-3333-444455556666"
  }
}
```

**SDK Code**

```python Created
import requests

url = "https://api-dev.houseofapps.ai/v1/integrations/clients/companies"

payload = { "name": "string" }
headers = {
    "appSecret": "appSecret",
    "licenseKey": "licenseKey",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Created
const url = 'https://api-dev.houseofapps.ai/v1/integrations/clients/companies';
const options = {
  method: 'POST',
  headers: {
    appSecret: 'appSecret',
    licenseKey: 'licenseKey',
    'Content-Type': 'application/json'
  },
  body: '{"name":"string"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Created
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api-dev.houseofapps.ai/v1/integrations/clients/companies"

	payload := strings.NewReader("{\n  \"name\": \"string\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("appSecret", "appSecret")
	req.Header.Add("licenseKey", "licenseKey")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Created
require 'uri'
require 'net/http'

url = URI("https://api-dev.houseofapps.ai/v1/integrations/clients/companies")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["appSecret"] = 'appSecret'
request["licenseKey"] = 'licenseKey'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"string\"\n}"

response = http.request(request)
puts response.read_body
```

```java Created
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api-dev.houseofapps.ai/v1/integrations/clients/companies")
  .header("appSecret", "appSecret")
  .header("licenseKey", "licenseKey")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"string\"\n}")
  .asString();
```

```php Created
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api-dev.houseofapps.ai/v1/integrations/clients/companies', [
  'body' => '{
  "name": "string"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'appSecret' => 'appSecret',
    'licenseKey' => 'licenseKey',
  ],
]);

echo $response->getBody();
```

```csharp Created
using RestSharp;

var client = new RestClient("https://api-dev.houseofapps.ai/v1/integrations/clients/companies");
var request = new RestRequest(Method.POST);
request.AddHeader("appSecret", "appSecret");
request.AddHeader("licenseKey", "licenseKey");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Created
import Foundation

let headers = [
  "appSecret": "appSecret",
  "licenseKey": "licenseKey",
  "Content-Type": "application/json"
]
let parameters = ["name": "string"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api-dev.houseofapps.ai/v1/integrations/clients/companies")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```