> For the complete documentation index, see [llms.txt](https://api-docs.devhub.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api-docs.devhub.com/core-resources/businesses.md).

# Businesses

Covered in this doc:

* [List businesses](/core-resources/businesses.md#list-businesses)
* [Get a single business](/core-resources/businesses.md#get-a-single-business)
* [Create a business](/core-resources/businesses.md#create-a-business)
* [Updating a business](/core-resources/businesses.md#updating-a-business)

## List businesses

List all business including active and deleted

```
GET /api/v2/businesses/
```

List all active businesses

```
GET /api/v2/businesses/?deleted=0
```

### Parameters

| Name                  | Type     | Description                                                                                                                                                                                        |
| --------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `added__date`         | `string` | Filter for businesses created on a particular date in `YYYY-MM-DD` format                                                                                                                          |
| `order_by`            | `string` | Set the field to sort the results by. Available `order_by` includes `id` (default) and `business_name`. You can also sort decending by prefixing the field with a minus sign (i.e. `order_by=-id`) |
| `partner_business_id` | `string` | Used to lookup/search for businesses matching a particular internal id                                                                                                                             |
| `partner_sub_id`      | `string` | Used by multi-level private labels to filter businesses to one partner based on their assigned sub ID                                                                                              |

### Response

```javascript
{
  "meta": {
    "limit": 20,
    "next": "/api/v2/businesses/?limit=20&offset=20",
    "offset": 0,
    "previous": null,
    "total_count": 1039
  },
  "objects": [
    {
      "added": "2013-05-24T11:40:21",
      "business_name": "Some Business Name",
      "category_id": null,
      "deleted": false,
      "id": 24305,
      "modified": "2014-01-21T10:37:39",
      "partner_business_id": null,
      "partner_sub_id": null,
      "resource_uri": "/api/v2/businesses/24305/",
      "slug": "some-business-name",
      "user_id": 142606
    },
    {
      "added": "2013-05-24T11:40:21",
      "business_name": "Another Business Name",
      "category_id": null,
      "deleted": false,
      "id": 24306,
      "modified": "2014-01-21T10:37:39",
      "partner_business_id": null,
      "partner_sub_id": null,
      "resource_uri": "/api/v2/businesses/24306/",
      "slug": "another-business-name",
      "user_id": 142606
    },
    ...
  ]
}
```

## Get a single business

Fetch the Business detail using the `Business.id`

```
GET /api/v2/businesses/:id/
```

### Response

```javascript
{
  "added": "2013-05-24T11:40:21",
  "business_name": "Some Business Name",
  "category": null,
  "category_id": null,
  "deleted": false,
  "id": 24305,
  "images": [
    ... list of the `Image` objects associated with the Business
  ],
  "logo_image": {
    ... fully expanded `Image` object for the Business' logo
  },
  "logo_image_id": 12345,
  "modified": "2014-01-21T10:37:39",
  "partner_business_id": null,
  "partner_sub_id": null,
  "resource_uri": "/api/v2/businesses/24305/",
  "services": [
    ... list of business `Service` objects
  ],
  "slug": "some-business-name",
  "user_id": 142606
}
```

## Create a business

```
POST /api/v2/businesses/
```

### Parameters

| Name            | Type     | Description                       |
| --------------- | -------- | --------------------------------- |
| `business_name` | `string` | **required** Name of the Business |

#### Example

```javascript
{
  "business_name": "Example Business",
  "partner_business_id": "uid-12347",
  "locations": [
    {
      "contact_email": "contact@somebusiness.com",
      "description":"<p>Here is a description of the business/location</p>",
      "street": "555 Main St",
      "city": "Seattle",
      "state": "WA",
      "postal_code": "98121",
      "country": "US",
      "phones": [
        {
          "type": "phone",
          "number": "206-555-5555"
        }
      ]
    }
  ]
}
```

### Response

A status code of `201 created` is returned on a successful creation and contains the created business object as JSON. See the [Get a single business](/core-resources/businesses.md#get-a-single-business) section for an example Business object.

## Updating a business

```
PUT /api/v2/business/:id/
```

You can `PUT` a partial or full object to the detail endpoint to update/change values on the Business object. If using a partial object, you must insure that the primary business `id` is part of the payload.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://api-docs.devhub.com/core-resources/businesses.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
