# `Codat.Platform.Companies`
[🔗](https://github.com/iamkanishka/codat.git/blob/v1.0.0/lib/codat/platform/companies.ex#L1)

Manage Codat companies (your customers).

A company represents a customer's business entity. Every piece of financial
data is scoped to a company.

## Example

    {:ok, company} = Codat.Platform.Companies.create(client, %{name: "Acme Corp"})
    redirect_to(company["redirect"])

# `create`

```elixir
@spec create(Codat.Client.t() | map(), map() | keyword()) ::
  {:ok, map()} | {:error, Codat.Error.t()}
```

Creates a new company.

## Example

    {:ok, company} = Codat.Platform.Companies.create(client, %{
      name: "Acme Corp",
      tags: %{"tenant_id" => "t_123"}
    })

# `delete`

```elixir
@spec delete(Codat.Client.t() | String.t(), String.t() | keyword()) ::
  {:ok, nil} | {:error, Codat.Error.t()}
```

Permanently deletes a company and all its data.

# `get`

```elixir
@spec get(Codat.Client.t() | String.t(), String.t() | keyword()) ::
  {:ok, map()} | {:error, Codat.Error.t()}
```

Fetches a single company by ID.

# `get_access_token`

```elixir
@spec get_access_token(Codat.Client.t() | String.t(), String.t() | keyword()) ::
  {:ok, map()} | {:error, Codat.Error.t()}
```

Generates a short-lived access token for the Link flow.

# `list`

```elixir
@spec list(
  Codat.Client.t() | keyword(),
  keyword()
) :: {:ok, Codat.Pagination.t()} | {:error, Codat.Error.t()}
```

Returns a paginated list of companies.

## Options

- `:page`, `:page_size` — pagination
- `:query` — filter string
- `:order_by` — sort field
- `:tags` — filter by tag, e.g. `"region:us-east-1"`

# `stream`

```elixir
@spec stream(
  Codat.Client.t() | keyword(),
  keyword()
) :: Enumerable.t()
```

Returns a lazy `Stream` of all companies.

# `update`

```elixir
@spec update(Codat.Client.t() | String.t(), String.t() | map(), map() | keyword()) ::
  {:ok, map()} | {:error, Codat.Error.t()}
```

Updates a company's name, description, or tags.

> **Warning:** Always include all tags you wish to retain. An empty `tags`
> map removes all existing tags.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
