> ## Documentation Index
> Fetch the complete documentation index at: https://www.plain.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Upsert a company

<Snippet file="graphql/sdk-note.mdx" />

Plain auto-creates companies from customer email domains, but you can also upsert them directly via the API. This is useful when you want to set details like the company name, logo or account owner ahead of any customers being created.

`upsertCompany` will create a new company if one with the given identifier doesn't exist, or update it in place if it does. The mutation returns a `result` field of either `CREATED` or `UPDATED` so you can tell which happened.

A company is identified by either its Plain `companyId` or its `companyDomainName`. When upserting by domain, you can pass either a bare domain (e.g. `plain.com`) or a full URL (e.g. `https://www.plain.com`) and we'll extract the domain for you.

This operation requires the following permissions:

* `company:create`
* `company:edit`

<Snippet file="graphql/upsert-company.mdx" />
