---
title: "Companies"
description: "OQL field reference for companies. Organization records that contacts can be linked to."
canonical_url: https://developer.onepagecrm.com/oql/entities/companies/
source: Markdown mirror of https://developer.onepagecrm.com/oql/entities/companies/
---

A company groups its contacts. Companies aren't standalone: one is
created automatically from a contact's company name, and a contact
references its company via `company_id`.

## Fields

Legend: **F** filterable, **S** sortable, **A** aggregatable, **G** groupable.

| Field | Type | F | S | A | G | Description |
|-------|------|:-:|:-:|:-:|:-:|-------------|
| `id` | ID | Y | — | — | — | Company ID |
| `name` | string | Y | Y | — | — | Company name |
| `description` | string | — | — | — | — | Description (select only) |
| `phone` | string | Y | — | — | — | Phone number |
| `url` | string | — | — | — | — | Website URL (select only) |
| `address` | string | Y | — | — | — | Street address |
| `city` | string | Y | Y | — | Y | City |
| `state` | string | Y | Y | — | Y | State or province |
| `zip_code` | string | Y | — | — | — | ZIP or postal code |
| `country_code` | string | Y | Y | — | Y | ISO 3166-1 alpha-2 country code |
| `created_at` | time | Y | Y | — | Y | Record creation timestamp |
| `modified_at` | time | Y | Y | — | Y | Last modification timestamp |

## Notes

- Companies are linked to contacts through the `company_id` field on
  the contact, not through any field on the company itself. To find a
  company's contacts, query `contacts` with
  `where: { "company_id": "..." }`.
- **Custom fields** are queryable by name as `custom_fields.<name>` in
  `select`, `where`, and `order_by`; select `custom_fields.*` (or `*`)
  to return all of them. Filterability and sortability depend on the
  field's type. Numeric custom fields can also be aggregated
  (`{ "sum": ["custom_fields.<name>"] }`), and `min`/`max` work on date
  custom fields. `group_by` and `distinct` on custom fields are not
  supported: group by a top-level field and filter on the custom field
  in `where` instead. Use [`describe`](/mcp/tools/describe/) to
  discover an account's custom-field names and types.

## Example queries

Companies in the US, alphabetically:

```json
{
  "from": "companies",
  "where": { "country_code": "US" },
  "order_by": ["name"]
}
```

Companies in each country:

```json
{
  "from": "companies",
  "select": ["country_code", "count()"],
  "group_by": ["country_code"]
}
```

All contacts at a specific company:

```json
{
  "from": "contacts",
  "where": { "company_id": "507f1f77bcf86cd799439011" }
}
```
