Partner integration endpoints
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.
Create a company
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.
Account hierarchy
Partner companies exist within a simplified hierarchy:
- Partner account: The partner’s top-level account
- Employer account: Child accounts created under the partner, each containing one or many companies
When using this endpoint, the company is automatically associated with an employer account under the authenticated partner’s account.
Create companies with affiliate accounts
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.
Request parameters
Required parameters
Optional parameters
| Parameter | Type | Description |
|---|---|---|
partner_account_id | string | The partner account ID that will own 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, partnership, etc.) |
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 |
Address object structure
Response structure
The response returns the created company object.
All submitted company details also return in the response.
Related models
When creating a partner company, the system also creates:
- Employer account: Automatically created if one doesn’t exist for this customer
- Company details: Extended company information
- Addresses: Physical and mailing addresses
- Individuals: Owners, officers, and authorized signatories
- Businesses: Related business entities
Authentication
Creating companies with affiliate accounts requires partner API key authentication:
- Production:
Authorization: Bearer mk_live_{your_partner_key} - Sandbox:
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.
Example request
Example request for affiliate account
Create an application
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.
Create an application with affiliate accounts
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.
Request parameters
Required parameters
Optional parameters (prefill data)
When creating an application, prefill data to reduce employer friction:
- Company details (legal_name, ein, entity_type)
- Address information
- Individual/owner information
Prefilling data streamlines the application process and improves completion rates.
Response structure
The response returns the created application object.
Example request
Example request for affiliate-owned company
Webhooks for partner application updates
Partners should subscribe to these webhook events:
partner.application.createdpartner.application.updatedpartner.application.submitted
Webhook 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.
Sandbox testing
Both partner endpoints are available in the sandbox environment:
- Base URL:
https://api-sandbox.middesk.com - API keys: Use test API keys:
mk_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.
Error handling
Both endpoints return standard HTTP status codes:
Error responses include: