This reference documents two API endpoints used in Middesk’s Entity Management product for agent partners. These endpoints enable partners to create companies and applications on behalf of their customers through the agent API context.
The Create a company endpoint creates a company record within a partner’s Middesk account.
A company represents one employer/entity with a single FEIN (Federal Employer Identification Number). Companies are the foundational entity for tax registrations, foreign qualifications, and other entity management services managed by the partner on behalf of their customers.
Partner companies exist within a simplified hierarchy:
When using this endpoint, the company is automatically associated with an employer account under the authenticated partner’s account.
Partners can organize companies under different affiliate structures while maintaining centralized management. This approach is useful for partners who manage multiple brands, regional offices, or reseller relationships through affiliate accounts.
To create companies under an affiliate account, specify the affiliate’s partner_account_id as the partner_account_id parameter in the request.
Authenticate with your partner-level API key (not the affiliate’s key).
The company is created under the affiliate’s account hierarchy, and all subsequent operations on the company are scoped to the affiliate account.
| Parameter | Type | Description |
|---|---|---|
partner_account_id | string | The partner account ID that owns this company (can be an affiliate account ID) |
id | string | Custom ID for the company |
external_id | string | Partner’s external reference ID for this company |
provider | string | Integration provider name |
provider_access_token | string | OAuth access token for provider integrations |
provider_refresh_token | string | OAuth refresh token for provider integrations |
provider_company_id | string | Company ID in the provider’s system |
dba_name | string | Doing Business As name |
contact_email | string | Primary contact email |
contact_name | string | Primary contact name |
contact_phone_number | string | Primary contact phone number |
contact_title | string | Primary contact’s job title |
entity_type | string | Legal entity type (corporation, LLC, or partnership) |
formation_date | string | Date company was formed (YYYY-MM-DD format) |
formation_state | string | State where company was formed (two-letter abbreviation) |
addresses | array | Array of address objects (see address structure below) |
individuals | array | Array of individual/owner objects |
businesses | array | Array of related business entities |
The response returns the created company object.
All submitted company details also return in the response.
When creating a partner company, the system also creates:
Creating companies with affiliate accounts requires partner API key authentication:
Authorization: Bearer mk_live_{your_partner_key}Authorization: Bearer mk_test_{your_partner_key}When creating companies under affiliate accounts, always use the parent partner’s API key. The partner_account_id parameter determines which account owns the company, not the API key used for authentication.
The Create an application endpoint creates an application for a partner company to register for tax registrations, foreign qualifications, or other entity management services.
Applications represent the employer’s intent to register with state/local agencies and collect the necessary information to complete those registrations. This endpoint is designed for partners managing the registration process on behalf of their customers.
Partners can create applications for companies that belong to affiliate accounts. The application automatically inherits the account context from the company it references.
When creating applications for affiliate-owned companies, reference the company_id of a company created under the affiliate account and authenticate with your partner-level API key.
The application is associated with the affiliate’s partner_account_id. All application-related webhooks and updates include the affiliate account context.
This ensures proper attribution and reporting for affiliate-managed registrations.
When creating an application, prefill data to reduce employer friction:
Prefilling data streamlines the application process and improves completion rates.
The response returns the created application object.
Partners should subscribe to these webhook events:
partner.application.createdpartner.application.updatedpartner.application.submittedWebhook events for companies and applications under affiliate accounts include the affiliate’s partner_account_id in the payload, allowing partners to route notifications and updates appropriately.
Both partner endpoints are available in the sandbox environment:
https://api-sandbox.middesk.commk_test_{your_partner_key}Use the sandbox to simulate registration outcomes using test endpoints, test different state requirements and workflows, and test affiliate account workflows by creating test affiliate accounts.
Both endpoints return standard HTTP status codes:
Error responses include: