# List companies

`GET /client_api/v2/companies`

For resellers. The client companies you can see.

## Returns

Returns a list of companies.

- `companies` (array of objects, required): The companies on this page.
  - `id` (integer, required): The company's id.
  - `account_number` (string, required): The company's account number. Order reference numbers start with it.
  - `account_status` (enum, required): Whether the company can ship. A suspended or dormant company gets no waybills. Possible enum values: `active`, `suspended`, `dormant`.
  - `address` (object, required): The company's address.
    - `id` (integer, required): The address's id. Send it as `origin_address_id` or `destination_address_id` to use the address again.
    - `address_1` (string, required): The street address. At most 34 characters.
    - `address_2` (string, nullable, required): A second address line, such as a floor or unit. At most 34 characters.
    - `address_3` (object, nullable, required): A third address line.
    - `city` (string, required): The city or town. At most 20 characters.
    - `classification` (enum, required): Whether the address is a business or a home. Carriers charge more to deliver to a home. Possible enum values: `business`, `residential`.
    - `company` (string, required): The company at the address. At most 35 characters.
    - `country_id` (integer, required): The country. Take the id from List countries.
    - `email` (string, required): An email address for the person at the address. Carriers use it for delivery notices.
    - `import_code` (object, nullable, required): The importer number of the party at the address. The country's `import_code_label` says what it is called there.
    - `latitude` (object, nullable, required): Where the address is, filled in by us shortly after the address is saved. Empty until then.
    - `longitude` (object, nullable, required): Where the address is, filled in by us shortly after the address is saved. Empty until then.
    - `name` (string, required): The person to ask for. At most 35 characters.
    - `phone` (string, required): A phone number for the person at the address. At most 15 characters.
    - `postal_code` (string, required): The postal code. Some countries, such as Ireland, refuse an address without one.
    - `province` (string, required): The province, state or county.
    - `summary` (string, required): The country's name.
    - `tax_number` (object, nullable, required): The tax or VAT number of the party at the address. The country's `tax_number_label` says what it is called there.
    - `time_zone_id` (object, nullable, required): The address's time zone, filled in by us shortly after the address is saved. Empty until then.
  - `api_users` (array of objects, required): The company's logins.
    - `id` (integer, required): The login's id.
    - `email` (string, required): The login's email address.
    - `identity` (string, required): The login's name, or its email address when it has no name.
  - `code` (string, required): The company's code with us, the same as its account number.
  - `company_billing` (boolean, required): `true` when we invoice the company directly, `false` when we invoice you as its reseller.
  - `currency_id` (string, required): The currency the company is billed in.
  - `name` (string, required): The company's name.
- `meta` (object, required): How many pages and records the list has.
  - `page_count` (integer, required): How many pages the list has. Ask for another with `?page=`.
  - `record_count` (integer, required): How many records the list has across all pages.

## Errors

- `401 Unauthorized`: The token is missing, expired or invalid. Sign in again.

## Example request (curl)

```bash
curl -X GET "https://sandbox-api.vatit-stream.com/client_api/v2/companies" \
  -H "Authorization: Bearer $API_TOKEN"
```

## Example response (200)

```json
{
  "companies": [
    {
      "id": 9,
      "account_number": "MYSGLO001",
      "account_status": "active",
      "address": {
        "id": 143,
        "address_1": "14 Bree Street",
        "address_2": "Unit 3",
        "address_3": null,
        "city": "Cape Town",
        "classification": "business",
        "company": "Global Trade Corp",
        "country_id": 20,
        "email": "dispatch@globaltradecorp.example",
        "import_code": null,
        "latitude": null,
        "longitude": null,
        "name": "Thandi Mokoena",
        "phone": "+27215550142",
        "postal_code": "8001",
        "province": "Western Cape",
        "summary": "South Africa",
        "tax_number": null,
        "time_zone_id": null
      },
      "api_users": [
        {
          "id": 13,
          "email": "integrations@globaltradecorp.example",
          "identity": "Thandi Mokoena"
        }
      ],
      "code": "MYSGLO001",
      "company_billing": true,
      "currency_id": "ZAR",
      "name": "Global Trade Corp"
    },
    {
      "id": 10,
      "account_number": "MYSKAR001",
      "account_status": "active",
      "address": {
        "id": 146,
        "address_1": "8 Church Street",
        "address_2": null,
        "address_3": null,
        "city": "Prince Albert",
        "classification": "business",
        "company": "Karoo Leather Works",
        "country_id": 20,
        "email": "pieter@karooleather.example",
        "import_code": null,
        "latitude": null,
        "longitude": null,
        "name": "Pieter van Wyk",
        "phone": "+27235550198",
        "postal_code": "6930",
        "province": "Western Cape",
        "summary": "South Africa",
        "tax_number": null,
        "time_zone_id": null
      },
      "api_users": [
        {
          "id": 14,
          "email": "admin@karooleather.example",
          "identity": "admin@karooleather.example"
        }
      ],
      "code": "MYSKAR001",
      "company_billing": true,
      "currency_id": "ZAR",
      "name": "Karoo Leather Works"
    }
  ],
  "meta": {
    "page_count": 1,
    "record_count": 2
  }
}
```
