fastify-xhubspot
companies.create
Create a new HubSpot company from a properties object.
companies.create
Create a new company in HubSpot CRM.
Signature
fastify.companies.create(
companyData: Record<string, string>
): Promise<{ id: string; properties: Record<string, string> }>
Params
| Name | Type | Required | Description |
|---|---|---|---|
companyData | object | Yes | Map of HubSpot property names to values. Common properties: name, domain, industry, phone, city, country. |
Returns
| Field | Type | Description |
|---|---|---|
id | string | HubSpot company ID. |
properties | object | Stored properties for the company. |
Throws
[xHubspot] companies.create requires a companyData object— ifcompanyDatais missing or not an object.- Re-throws the HubSpot API error on failure.
Examples
Basic
const company = await fastify.companies.create({
name: "Acme Corp",
domain: "acme.com",
industry: "TECHNOLOGY",
});
On account sign-up
fastify.post("/accounts", async (request, reply) => {
const { orgName, domain, plan } = request.body;
const company = await fastify.companies.create({
name: orgName,
domain,
hs_lead_status: "NEW",
plan__c: plan,
});
return reply.code(201).send({ companyId: company.id });
});
See also
- companies.update — update an existing company
- companies.getById — fetch company details after creation
- contacts.associate — link a contact to this company
AI Context
package: "@xenterprises/fastify-xhubspot"
method: fastify.companies.create(companyData)
use-when: Create a new HubSpot company record
returns: { id, properties, createdAt }
