Back to top

Green Bits API V1

Authentication

Get API Token

Green Bits primarily uses token based authentication. To retrieve your API token, send a GET request to /api/v1/me using basic authentication and the email and password of any valid user in the API application’s database.

Limiting API Response Data to a Specific Location

If a user has access to multiple locations, you can constrain the API to a specific location by setting the X-GB-CompanyId in the header of all API requests with the specific location’s ID.

Note that without the X-GB-CompanyId header, API responses will automatically constrain to the token owner’s first accessible location.

Authorization: Token token="{your_token}"
X-GB-CompanyId: {company_id}

View Your Details
GET/me

Example URI

GET https://api.greenbits.com/api/v1/me
Request
HideShow
Headers
Authorization: Basic {basic_auth_token}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "user": {
    "id": "5d44d604-81b5-4b16-ade4-f204f3d494dc",
    "username": "janedoe",
    "email": "jane@example.com",
    "first_name": "Jane",
    "last_name": "Doe",
    "name": "Jane Doe",
    "token": "53MdJBaKnKMUWEfXDparpQ",
    "budtender": false,
    "created_at": "2015-07-10T10:59:26-07:00",
    "company_id": "407fa200-0108-4b30-8fa1-7699442538b2"
  }
}
Response  401
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "Invalid email or password."
}

Authenticate with Token

Now that you have your API token, you can test it out by retrieving your company’s details. Using the company id from the previous request, fetch your company’s details with the following request.

View Company Details
GET/companies/{company_id}

Example URI

GET https://api.greenbits.com/api/v1/companies/company_id
URI Parameters
HideShow
company_id
string (required) 

ID of your company

Request
HideShow
Headers
Authorization: Token token="{your_token}"
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "company": {
    "id": "407fa200-0108-4b30-8fa1-7699442538b2",
    "name": "Jane's Pot Shop",
    "street": "1234 Rad Street",
    "city": "San Jose",
    "state": "CA",
    "zip_code": "95124"
  }
}

Customer

  • Attributes
    • id (string)
    • company_id (required, string) - The company to attach this customer to.
    • first_name (optional, string)
    • last_name (optional, string)
    • email (required, string) - Either phone or email is required.
    • phone (required, string) - Either phone or email is required. Must be a valid phone number, but don’t worry about formatting. The API will format the phone number in the response.

Customers Collection

Customers Collection
GET/customers{?by_query}

Example URI

GET https://api.greenbits.com/api/v1/customers?by_query=
URI Parameters
HideShow
by_query
string (optional) 

Filters the customers by this query string. It returns any customers whose first name, last name, email, or phone contain the provided string.

Request
HideShow
Headers
Authorization: Token token="{your_token}"
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "customers": [
    {
      "id": "520aa7d7-a25e-48c4-811f-d2454eb03467",
      "first_name": "John",
      "last_name": "Smith",
      "email": "john@example.com",
      "phone": "888-555-1111",
      "birth_date": "1976-04-03T00:00:00.000Z",
      "company_id": "a73e4ad0-d48b-4981-b764-1418e04d9ce4"
    }
  ]
}

Create Customer

Create Customer
POST/customers

Example URI

POST https://api.greenbits.com/api/v1/customers
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "customer": {
    "first_name": "John",
    "last_name": "Smith",
    "email": "john@example.com",
    "phone": "8885551111",
    "birth_date": "1976-04-03T00:00:00.000Z",
    "company_id": "a73e4ad0-d48b-4981-b764-1418e04d9ce4"
  }
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "customer": {
    "id": "520aa7d7-a25e-48c4-811f-d2454eb03467",
    "first_name": "John",
    "last_name": "Smith",
    "email": "john@example.com",
    "phone": "888-555-1111",
    "birth_date": "1976-04-03T00:00:00.000Z",
    "company_id": "a73e4ad0-d48b-4981-b764-1418e04d9ce4"
  }
}
Response  422
HideShow
Headers
Content-Type: application/json
Body
{
  "errors": {
    "email": [
      "is not a valid email"
    ],
    "phone": [
      "is not a valid phone number"
    ]
  }
}

Inventory Item

The Inventory Item endpoint only provides you with information about the inventory item. It does not contain product-level information. Use this endpoint if you need to modify the inventory item or use the inventory item metadata field.

  • Attributes
    • id (string) - The inventory item ID.
    • product_id (string) - The ID of the product to which this item belongs.
    • sku (string)
    • lot_number (string)
    • quantity (number) - Quantity left on hand.
    • weight (string) - Weight in grams.
    • sell_type (number) - An Enum indicating this item’s sell type. The valid options are:
      • 0: Sellable
      • 1: Unsellable
      • 2: Locked - This means it was locked by Green Bits, either because it’s a sample jar or it has been transferred out.
    • sample (boolean) - A boolean indicating whether this item is a sample.
    • transferred_out (boolean) - A boolean indicating whether this item has been transferred out.
    • received_at (timestamp) - A timestamp indicating the first time this item was received.
    • test_results_thc (string) - THC percentage (10% being represented at 0.10) indicated by the latest test results.
    • test_results_cbd (string) - CBD percentage (10% being represented at 0.10) indicated by the latest test results.
    • metadata (json) - A JSON field that you can use to store metadata about this item.

Inventory Item

View an Inventory Item's Detail
GET/inventory_items/{inventory_item_id}

Example URI

GET https://api.greenbits.com/api/v1/inventory_items/inventory_item_id
URI Parameters
HideShow
inventory_item_id
string (required) 

ID of the inventory item

Request
HideShow
Headers
Authorization: Token token="{your_token}"
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "inventory_item": {
    "id": "dc558fe9-7c1f-41c3-ba90-fe4d602e57ca",
    "sku": "1234567890123459",
    "quantity": 5,
    "weight": null,
    "purchase_price": 666,
    "lot_number": "1234567890123459",
    "sell_type": 3,
    "sample": false,
    "transferred_out": false,
    "received_at": "2020-09-07T09:40:59.000Z",
    "metadata": null,
    "test_results_thc": "0.13",
    "test_results_cbd": "0.04",
    "sellable_quantity": 0,
    "product": {
      "id": "1ee050d1-d08f-4bea-840e-f3a3a01d994a",
      "sku": null,
      "name": "AK-47",
      "sell_price": 1400,
      "collect_excise_tax": true,
      "quantity": 107,
      "pricing_type": 0,
      "vendor": "Katz Kush Farms",
      "active": true,
      "latest_sku": "1234567890123455",
      "weight": null,
      "tags": [],
      "description": null,
      "internal_notes": null,
      "metadata": null,
      "test_results_thc": "0.35",
      "test_results_cbd": "0.005",
      "flower_type": 1,
      "concentrate_type": null,
      "category_id": "76f4b09d-a49a-4e83-bdc7-7424ffe6ee4f",
      "brand_id": "774ef7ee-38ab-469a-9789-9b53aaeab229",
      "strain_id": "abcdec1a-2020-42e8-adbe-621efb760000",
      "product_type_id": "882d74f6-d0fa-4abb-a962-02c32f229fb0"
    },
    "inventory_item_places": [
      {
        "id": "d6eb5219-eac3-4e58-9dd7-0f2e5d070daf",
        "quantity": {
          "value": "0.0",
          "unit": 0
        },
        "sellable_quantity": {
          "value": "0.0",
          "unit": 0
        },
        "inventory_status": 0,
        "place_id": "d4668dd4-ea5f-49b2-8acf-6b1defc4db6e",
        "inventory_item_id": "dc558fe9-7c1f-41c3-ba90-fe4d602e57ca"
      },
      {
        "id": "1d965dcf-f72c-4b4f-abfc-99551934c3f5",
        "quantity": {
          "value": "0.0",
          "unit": 0
        },
        "sellable_quantity": {
          "value": "0.0",
          "unit": 0
        },
        "inventory_status": 1,
        "place_id": "26f3b975-ac94-4810-9ad8-643a2b3aeb79",
        "inventory_item_id": "dc558fe9-7c1f-41c3-ba90-fe4d602e57ca"
      },
      {
        "id": "45b10003-6137-4e6a-add5-9e5bc2e783a0",
        "quantity": {
          "value": "5.0",
          "unit": 0
        },
        "sellable_quantity": {
          "value": "0.0",
          "unit": 0
        },
        "inventory_status": 3,
        "place_id": "77755ba4-6437-4f75-a482-cbf7ee69b70a",
        "inventory_item_id": "dc558fe9-7c1f-41c3-ba90-fe4d602e57ca"
      },
      {
        "id": "83f42262-63af-4fba-9d25-4babff6a157e",
        "quantity": {
          "value": "0.0",
          "unit": 0
        },
        "sellable_quantity": {
          "value": "0.0",
          "unit": 0
        },
        "inventory_status": 2,
        "place_id": "59cf8b9c-78c2-499d-aff1-8d21c022d3e4",
        "inventory_item_id": "dc558fe9-7c1f-41c3-ba90-fe4d602e57ca"
      },
      {
        "id": "9010f610-8567-4f27-aace-bae582952aad",
        "quantity": {
          "value": "0.0",
          "unit": 0
        },
        "sellable_quantity": {
          "value": "0.0",
          "unit": 0
        },
        "inventory_status": 4,
        "place_id": "5327118e-4f44-4a62-9417-c9306159f5d6",
        "inventory_item_id": "dc558fe9-7c1f-41c3-ba90-fe4d602e57ca"
      }
    ]
  }
}

Update an Inventory Item
PUT/inventory_items/{inventory_item_id}

The request below only shows the fields that you are allowed to update.

Example URI

PUT https://api.greenbits.com/api/v1/inventory_items/inventory_item_id
URI Parameters
HideShow
inventory_item_id
string (required) 

ID of the inventory item

Request
HideShow

{ “inventory_item”: { “id”: “c93e96f7-40a5-4225-a324-c9c80c3f14f8”, “product_id”: “4678c18a-5a5f-49a2-90ad-1908312e6235”, “sku”: “3156156207772758”, “sell_type”: 0, “metadata”: { “bin_id”: “R-23” } } }

Headers
Content-Type: application/json
Authorization: Token token="{your_token}"
Response  204

Inventory Item Collection

List All Inventory Items
GET/inventory_items{?limit}{?offset}{?sellable}{?only_assigned}{?by_sku}{?by_lot_number}{?by_product_id}{?by_product_name}

Example URI

GET https://api.greenbits.com/api/v1/inventory_items?limit=10?offset=0?sellable=true?only_assigned=false?by_sku=1234?by_lot_number=1234?by_product_id=4678c18a-5a5f-49a2-90ad-1908312e6235?by_product_name=BM: Bubba Kush
URI Parameters
HideShow
limit
number (optional) Example: 10

The maximum number of inventory items to return.

offset
number (optional) Example: 0

The number of inventory items to skip before returning inventory items.

sellable
boolean (optional) Example: true

Only return sellable inventory items.

only_assigned
boolean (optional) Example: false

Also include inventory items that haven’t been associated with products.

by_sku
string (optional) Example: 1234

Filter results to only include items that match this SKU.

by_lot_number
string (optional) Example: 1234

Filter results to only include items that match this lot number.

by_product_id
string (optional) Example: 4678c18a-5a5f-49a2-90ad-1908312e6235

Filter results to only include items for this product.

by_product_name
string (optional) Example: BM: Bubba Kush

Filter results to only include items whose product name matches this string.

Request
HideShow
Headers
Authorization: Token token="{your_token}"
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "inventory_items": [
    {
      "id": "dc558fe9-7c1f-41c3-ba90-fe4d602e57ca",
      "sku": "1234567890123459",
      "quantity": 5,
      "weight": null,
      "purchase_price": 666,
      "lot_number": "1234567890123459",
      "sell_type": 3,
      "sample": false,
      "transferred_out": false,
      "received_at": "2020-09-07T09:40:59.000Z",
      "metadata": null,
      "test_results_thc": "0.13",
      "test_results_cbd": "0.04",
      "sellable_quantity": 0,
      "product": {
        "id": "1ee050d1-d08f-4bea-840e-f3a3a01d994a",
        "sku": null,
        "name": "AK-47",
        "sell_price": 1400,
        "collect_excise_tax": true,
        "quantity": 107,
        "pricing_type": 0,
        "vendor": "Katz Kush Farms",
        "active": true,
        "latest_sku": "1234567890123455",
        "weight": null,
        "tags": [],
        "description": null,
        "internal_notes": null,
        "metadata": null,
        "test_results_thc": "0.35",
        "test_results_cbd": "0.005",
        "flower_type": 1,
        "concentrate_type": null,
        "category_id": "76f4b09d-a49a-4e83-bdc7-7424ffe6ee4f",
        "brand_id": "774ef7ee-38ab-469a-9789-9b53aaeab229",
        "strain_id": "abcdec1a-2020-42e8-adbe-621efb760000",
        "product_type_id": "882d74f6-d0fa-4abb-a962-02c32f229fb0"
      },
      "inventory_item_places": [
        {
          "id": "d6eb5219-eac3-4e58-9dd7-0f2e5d070daf",
          "quantity": {
            "value": "0.0",
            "unit": 0
          },
          "sellable_quantity": {
            "value": "0.0",
            "unit": 0
          },
          "inventory_status": 0,
          "place_id": "d4668dd4-ea5f-49b2-8acf-6b1defc4db6e",
          "inventory_item_id": "dc558fe9-7c1f-41c3-ba90-fe4d602e57ca"
        },
        {
          "id": "1d965dcf-f72c-4b4f-abfc-99551934c3f5",
          "quantity": {
            "value": "0.0",
            "unit": 0
          },
          "sellable_quantity": {
            "value": "0.0",
            "unit": 0
          },
          "inventory_status": 1,
          "place_id": "26f3b975-ac94-4810-9ad8-643a2b3aeb79",
          "inventory_item_id": "dc558fe9-7c1f-41c3-ba90-fe4d602e57ca"
        },
        {
          "id": "45b10003-6137-4e6a-add5-9e5bc2e783a0",
          "quantity": {
            "value": "5.0",
            "unit": 0
          },
          "sellable_quantity": {
            "value": "0.0",
            "unit": 0
          },
          "inventory_status": 3,
          "place_id": "77755ba4-6437-4f75-a482-cbf7ee69b70a",
          "inventory_item_id": "dc558fe9-7c1f-41c3-ba90-fe4d602e57ca"
        },
        {
          "id": "83f42262-63af-4fba-9d25-4babff6a157e",
          "quantity": {
            "value": "0.0",
            "unit": 0
          },
          "sellable_quantity": {
            "value": "0.0",
            "unit": 0
          },
          "inventory_status": 2,
          "place_id": "59cf8b9c-78c2-499d-aff1-8d21c022d3e4",
          "inventory_item_id": "dc558fe9-7c1f-41c3-ba90-fe4d602e57ca"
        },
        {
          "id": "9010f610-8567-4f27-aace-bae582952aad",
          "quantity": {
            "value": "0.0",
            "unit": 0
          },
          "sellable_quantity": {
            "value": "0.0",
            "unit": 0
          },
          "inventory_status": 4,
          "place_id": "5327118e-4f44-4a62-9417-c9306159f5d6",
          "inventory_item_id": "dc558fe9-7c1f-41c3-ba90-fe4d602e57ca"
        }
      ]
    }
  ],
  "meta": {
    "total": 1
  }
}

Place

  • Attributes
    • id (string) - The place ID.
    • name (string)
    • description (string)
    • products_count (number) - An Integer representing the products amount associated with the place.
    • inventory_status (number) - An Enum indicating the place’s inventory status. The valid options are:
      • 0: For Sale
      • 1: Not For Sale
      • 2: Locked
      • 3: Quarantined
      • 4: On Hold

Place

View a Place's Detail
GET/places/{place_id}

Example URI

GET https://api.greenbits.com/api/v1/places/place_id
URI Parameters
HideShow
place_id
string (required) 

ID of the place

Request
HideShow
Headers
Authorization: Token token="{your_token}"
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "id": 91,
  "uuid": "d4668dd4-ea5f-49b2-8acf-6b1defc4db6e",
  "name": "Sales Floor",
  "inventory_status": 0,
  "description": "Inventory Items available for sale",
  "deleted_at": null,
  "is_deleted": false,
  "location_id": 3662,
  "account_id": 117,
  "created_at": "2021-03-26T10:41:18.000Z",
  "updated_at": "2021-03-26T10:41:18.000Z"
}

Places Collection

Places Collection
GET/places{?limit}{?offset}{?by_inventory_status}

Example URI

GET https://api.greenbits.com/api/v1/places?limit=10?offset=0?by_inventory_status=
URI Parameters
HideShow
limit
number (optional) Example: 10

The maximum number of places to return.

offset
number (optional) Example: 0

The number of places to skip before returning places.

by_inventory_status
number (optional) 

(number) - An Enum indicating the place’s Inventory status to filter.

  • 0: For Sale

  • 1: Not For Sale

  • 2: Locked

  • 3: Quarantined

  • 4: On Hold

Request
HideShow
Headers
Authorization: Token token="{your_token}"
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
    "places": [
      {
        "id": 91,
        "uuid": "d4668dd4-ea5f-49b2-8acf-6b1defc4db6e",
        "name": "Sales Floor",
        "inventory_status": 0,
        "description": "Inventory Items available for sale",
        "deleted_at": null,
        "is_deleted": false,
        "location_id": 3662,
        "account_id": 117,
        "created_at": "2021-03-26T10:41:18.000Z",
        "updated_at": "2021-03-26T10:41:18.000Z"
      }
  }

Product

  • Attributes
    • id (string) - The product ID.
    • name (string)
    • sell_price (number) - An Integer representing the sell price in cents.
    • collect_excise_tax (boolean) - Indicates whether this item is reported to the state.
    • quantity (number) - Quantity left on hand.
    • pricing_type (number) - An Enum indicating how this product is priced. The valid options are:
      • 0: Priced by unit
      • 1: Priced by gram
    • product_type_id (string)
    • brand_id (string)
    • strain_id (string)
    • vendor (string)
    • active (boolean) - A boolean indicating whether this product is active.
    • latest_sku (string) - A string representing the last sku attached to this product.
    • category_id (string)
    • tags (array)
    • description (string) - A string description of the product.
    • internal_notes (string) - A string for internal notes. This value is never displayed to the customer.
    • metadata (json) - A JSON field that you can use to store metadata about the product.
    • weight (weight) - The weight of the product, to be used for compliance validation and display.
      • value (string)
      • unit (number) - An Enum indicating the weight unit. The valid options are:
        • 0: Gram
        • 1: Ounce
    • test_results_thc (string) - THC percentage (10% being represented at 0.10) of this product.
    • test_results_cbd (string) - CBD percentage (10% being represented at 0.10) of this product.
    • flower_type (number) - An Enum indicating the product’s flower type. The valid options are:
      • 0: Indica
      • 1: Sativa
      • 2: Hybrid
      • 3: Indica Hybrid
      • 4: Sativa Hybrid
    • concentrate_type (number) - An Enum indicating the product’s concentrate type. The valid options are:
      • 0: Wax
      • 1: Shatter
      • 2: Live Resin
      • 3: Rosin
      • 4: Hash
      • 5: Cartridges
      • 6: Tankers
      • 7: Kief
      • 8: RSO
      • 9: Oil
      • 10: Distillate

Product

View a Product's Detail
GET/products/{product_id}

Example URI

GET https://api.greenbits.com/api/v1/products/product_id
URI Parameters
HideShow
product_id
string (required) 

ID of the product

Request
HideShow
Headers
Authorization: Token token="{your_token}"
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
    "product": {
        "id": "4678c18a-5a5f-49a2-90ad-1908312e6235",
        "active": false,
        "category_id": "0c006283-1cf1-4531-89cb-c0e64c7260e9",
        "collect_excise_tax": true,
        "id": "7f5b9dc6-962b-45d7-a749-fb1462096bad",
        "latest_sku": "3156156207772758",
        "name": "Girl Scout Cookies 3.5g",
        "pricing_type": 0,
        "product_type_id": "24516e82-e9d6-4695-890f-fa8b312b4163",
        "quantity": 10,
        "sell_price": 2500,
        "vendor": "Blewett Pass Farms",
        "brand_id": "bbd87743-73df-42d9-80b2-df1b6a645a2c",
        "strain_id": "6fe59013-8b12-41a5-8a69-aa80896cad45",
        "weight": "3.5",
        "tags": ['expiring', 'on sale'],
        "description": "Girl Scout Cookies, or GSC, is an OG Kush and Durban Poison hybrid cross whose reputation grew too large to stay within the borders of its California homeland",
        "internal_notes": "3/7/15: We need to order more of these. -AK",
        "test_results_thc": "0.1",
        "test_results_cbd": "0.003",
        "flower_type": 3,
        "metadata": {
          "external_id": "5"
        }
    }
}

Products Collection

List All Products
GET/products{?limit}{?offset}{?active}{?by_active}{?mj}{?para}{?by_name}{?by_vendor}{?by_category}{?by_sku}{?by_lot_number}{?by_product_type}{?by_brand}{?by_strain}{?by_discountable}

Example URI

GET https://api.greenbits.com/api/v1/products?limit=10?offset=0?active=true?by_active=true?mj=true?para=false?by_name=Bubba Kush, 1g?by_vendor=BMF?by_category=077dd560-0619-4559-8615-bde755c5a0f5?by_sku=1234?by_lot_number=1234123412341234?by_product_type=98f1bf43-4422-4f61-9ba9-5796e7a62edf?by_brand=Afgoo?by_strain=Jack Herer?by_discountable=true
URI Parameters
HideShow
limit
number (optional) Example: 10

The maximum number of products to return.

offset
number (optional) Example: 0

The number of products to skip before returning products.

active
boolean (optional) Example: true

Only return active products. DEPRECATED

by_active
boolean (optional) Example: true

Returns products in the provided active state.

mj
boolean (optional) Example: true

Only return products that are reported with the state.

para
boolean (optional) Example: false

Only return products that are not reported with the state.

by_discountable
boolean (optional) Example: true

Returns products that can or cannot be discounted.

by_name
string (optional) Example: Bubba Kush, 1g

Filter results by products matching this name.

by_vendor
string (optional) Example: BMF

Filter results by products matching this vendor name.

by_category
string (optional) Example: 077dd560-0619-4559-8615-bde755c5a0f5

Filter results by products matching this category ID.

by_sku
string (optional) Example: 1234

Filter results by products that contain inventory items matching this SKU.

by_lot_number
string (optional) Example: 1234123412341234

Filter results by products that contain inventory items matching this lot number.

by_product_type
string (optional) Example: 98f1bf43-4422-4f61-9ba9-5796e7a62edf

Filter results by products matching this product type ID.

by_brand
string (optional) Example: Afgoo

Filter results by products that matching this brand name.

by_strain
string (optional) Example: Jack Herer

Filter results by products that matching this strain name.

sort_by[field]
string (optional) Example: vendor

Sorts results by the field specified.

Choices: name product_type quantity sell_price vendor

sort_by[direction]
string (optional) Default: asc Example: desc

Takes the sorted results and arranges them in the specified direction.

This is only applied when the sort_by[field] params is provided.

Choices: asc desc

by_quantity[quantity]
string (optional) Example: 0

Filter results by products matching this quantity.

There are three options for this value:

  • Single number: 0 Filter results by comparing to a single value.

  • Range: 0,10 Filter results by quantity included in this range. You must use the between comparator in the by_quantity[comparator] parameter.

  • List: 0,10,20 Filter results by quantity that matches a number in this list. You must use the in comparator in the by_quantity[comparator] parameter.

In any case, you are required to specify the comparator in the by_quantity[comparator] parameter.

by_quantity[comparator]
string (optional) Example: <

Specifies the comparator to use when filtering by quantity.

Choices: < <= = >= > between in

by_sell_price[sell_price]
string (optional) Example: 2000

Filter results by products matching this sell price.

There are three options for this value:

  • Single price: 1000 Filter results by comparing to a single price.

  • Range: 1000,2000 Filter results by sell price included in this range. You must use the between comparator in the by_sell_price[comparator] parameter.

  • List: 0,1000,2000 Filter results by sell price that matches a price in this list. You must use the in comparator in the by_sell_price[comparator] parameter.

In any case, you are required to specify the comparator in the by_sell_price[comparator] parameter.

by_sell_price[comparator]
string (optional) Example: <

Specifies the comparator to use when filtering by sell price.

Choices: < <= = >= > between in

by_test_results_thc[test_results_thc]
string (optional) Example: 0.1

Filter results by products matching this THC test result.

There are three options for this value:

  • Single price: 0.1 Filter results by comparing to a single percentage.

  • Range: 0.1,0.2 Filter results by test results included in this range. You must use the between comparator in the by_test_results_thc[comparator] parameter.

  • List: 0,0.1,0.2 Filter results by test results that matches a price in this list. You must use the in comparator in the by_test_results_thc[comparator] parameter.

In any case, you are required to specify the comparator in the by_test_results_thc[comparator] parameter.

by_test_results_thc[comparator]
string (optional) Example: <

Specifies the comparator to use when filtering by THC test results.

Choices: < <= = >= > between in

by_test_results_cbd[test_results_cbd]
string (optional) Example: 0.1

Filter results by products matching this CBD test result.

There are three options for this value:

  • Single price: 0.1 Filter results by comparing to a single percentage.

  • Range: 0.1,0.2 Filter results by test results included in this range. You must use the between comparator in the by_test_results_cbd[comparator] parameter.

  • List: 0,0.1,0.2 Filter results by test results that matches a price in this list. You must use the in comparator in the by_test_results_cbd[comparator] parameter.

In any case, you are required to specify the comparator in the by_test_results_cbd[comparator] parameter.

by_test_results_cbd[comparator]
string (optional) Example: <

Specifies the comparator to use when filtering by CBD test results.

Choices: < <= = >= > between in

Request
HideShow
Headers
Authorization: Token token="{your_token}"
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
    "products": [
        {
            "id": "4678c18a-5a5f-49a2-90ad-1908312e6235",
            "active": false,
            "category_id": "0c006283-1cf1-4531-89cb-c0e64c7260e9",
            "collect_excise_tax": true,
            "id": "7f5b9dc6-962b-45d7-a749-fb1462096bad",
            "latest_sku": "3156156207772758",
            "name": "Girl Scout Cookies 3.5g",
            "pricing_type": 0,
            "product_type_id": "24516e82-e9d6-4695-890f-fa8b312b4163",
            "brand_id": "28ac6528-7c0d-48fc-a033-c403d636086f",
            "strain_id": "6fe59013-8b12-41a5-8a69-aa80896cad45",
            "quantity": 10,
            "sell_price": 2500,
            "vendor": "Blewett Pass Farms",
            "weight": "3.5",
            "tags": ['expiring', 'on sale'],
            "description": "Girl Scout Cookies, or GSC, is an OG Kush and Durban Poison hybrid cross whose reputation grew too large to stay within the borders of its California homeland",
            "internal_notes": "3/7/15: We need to order more of these. -AK",
            "test_results_thc": "0.1",
            "test_results_cbd": "0.003",
            "flower_type": 3,
            "metadata": {
              "external_id": "5"
            }
        }
    ],
    "meta": {
      "total": 1
    }
}

Product Type

  • Attributes
    • id (string)
    • name (string)
    • traceability_type (number) - An Enum indicating the corresponding traceability type. The valid options are:
      • 0: Other
      • 1: Usable Marijuana
      • 2: Solid Marijuana Infused Edible
      • 3: Liquid Marijuana Infused Edible
      • 4: Marijuana Extract for Inhalation
      • 5: Marijuana Infused Topicals
      • 6: Sample
    • can_edit_weight (boolean) - Whether or not to track weight for products of this type.
    • can_edit_strain (boolean) - Whether or not to track strain for products of this type.
    • can_edit_test_results (boolean) - Whether or not to track test results for products of this type.
    • can_edit_flower_type (boolean) - Whether or not to track flower type for products of this type.
    • can_edit_concentrate_type (boolean) - Whether or not to track concentrate type for products of this type.
    • is_marijuana (boolean) - Whether or not this product type is marijuana.
    • tax_item_ids (array) - The tax items that apply to this product type.
    • default (boolean) - Whether or not this is the default product type. The default type cannot be edited.
    • test_results_unit (number) - An Enum indicating the corresponding test result unit type. The valid options are:
      • 0: Percent
      • 1: Milligrams

Product Types Collection

Product Types Collection
GET/product_types

Example URI

GET https://api.greenbits.com/api/v1/product_types
Request
HideShow
Headers
Authorization: Token token="{your_token}"
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
    "product_types": [
      {
        "id": "bbd87743-73df-42d9-80b2-df1b6a645a2c",
        "name": "Flower",
        "traceability_type": 1,
        "can_edit_weight": true,
        "can_edit_strain": true,
        "can_edit_test_results": true,
        "can_edit_flower_type": true,
        "can_edit_concentrate_type": false,
        "is_marijuana": true,
        "tax_item_ids": ["31a6f2ac-ba33-4b3e-ac96-df3fbe0b35ad"],
        "default": false,
        "test_results_unit": 0,
      }
    ]
}

Brand

  • Attributes
    • id (string)
    • name (string)

Brands Collection

Brands Collection
GET/brands{?limit}{?offset}{?by_name}

Example URI

GET https://api.greenbits.com/api/v1/brands?limit=10?offset=0?by_name=Afgoo
URI Parameters
HideShow
limit
number (optional) Example: 10

The maximum number of brands to return.

offset
number (optional) Example: 0

The number of brands to skip before returning brands.

by_name
string (optional) Example: Afgoo

Return Brands that contain this string in their name.

sort_by[field]
string (optional) Example: name

Sorts results by the field specified.

Choices: name

sort_by[direction]
string (optional) Default: asc Example: desc

Takes the sorted results and arranges them in the specified direction.

This is only applied when the sort_by[field] params is provided.

Choices: asc desc

Request
HideShow
Headers
Authorization: Token token="{your_token}"
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
    "brands": [
      {
        "id": "bbd87743-73df-42d9-80b2-df1b6a645a2c",
        "name": "Afgoo",
      }
    ],
    "meta": {
      "total": 1
    }
}

Create Brand
POST/brands

Example URI

POST https://api.greenbits.com/api/v1/brands
Request
HideShow
Headers
Content-Type: application/json
Authorization: Token token="{your_token}"
Body
{
  "brand": {
    "id": "bbd87743-73df-42d9-80b2-df1b6a645a2c"
    "name": "Afgoo",
  }
}
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
  "brand": {
    "id": "bbd87743-73df-42d9-80b2-df1b6a645a2c"
    "name": "Afgoo",
  }
}

Brand Item

Show Brand
GET/brands/{id}

Example URI

GET https://api.greenbits.com/api/v1/brands/bbd87743-73df-42d9-80b2-df1b6a645a2c
URI Parameters
HideShow
id
string (required) Example: bbd87743-73df-42d9-80b2-df1b6a645a2c

The ID of the brand to show.

Request
HideShow
Headers
Authorization: Token token="{your_token}"
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "brand": {
    "id": "bbd87743-73df-42d9-80b2-df1b6a645a2c"
    "name": "Afgoo",
  }
}

Update Brand
PUT/brands/{id}

Example URI

PUT https://api.greenbits.com/api/v1/brands/bbd87743-73df-42d9-80b2-df1b6a645a2c
URI Parameters
HideShow
id
string (required) Example: bbd87743-73df-42d9-80b2-df1b6a645a2c

The ID of the brand to show.

Request
HideShow
Headers
Content-Type: application/json
Authorization: Token token="{your_token}"
Body
{
  "brand": {
    "id": "bbd87743-73df-42d9-80b2-df1b6a645a2c"
    "name": "Afgoo",
  }
}
Response  204

Strain

  • Attributes
    • id (string)
    • name (string)

Strains Collection

Strains Collection
GET/strains{?limit}{?offset}{?by_name}

Example URI

GET https://api.greenbits.com/api/v1/strains?limit=10?offset=0?by_name=Jack Herer
URI Parameters
HideShow
limit
number (optional) Example: 10

The maximum number of strains to return.

offset
number (optional) Example: 0

The number of strains to skip before returning strains.

by_name
string (optional) Example: Jack Herer

Return Strains that contain this string in their name.

sort_by[field]
string (optional) Example: name

Sorts results by the field specified.

Choices: name

sort_by[direction]
string (optional) Default: asc Example: desc

Takes the sorted results and arranges them in the specified direction.

This is only applied when the sort_by[field] params is provided.

Choices: asc desc

Request
HideShow
Headers
Authorization: Token token="{your_token}"
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "strains": [
    {
      "id": "bbd87743-73df-42d9-80b2-df1b6a645a2c",
      "name": "Jack Herer"
    }
  ],
  "meta": {
    "total": 1
  }
}

Create Strain
POST/strains

Example URI

POST https://api.greenbits.com/api/v1/strains
Request
HideShow
Headers
Content-Type: application/json
Authorization: Token token="{your_token}"
Body
{
  "strain": {
    "id": "bbd87743-73df-42d9-80b2-df1b6a645a2c"
    "name": "Jack Herer"
  }
}
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
  "strain": {
    "id": "bbd87743-73df-42d9-80b2-df1b6a645a2c"
    "name": "Jack Herer"
  }
}

Strain Item

Show Strain
GET/strains/{id}

Example URI

GET https://api.greenbits.com/api/v1/strains/bbd87743-73df-42d9-80b2-df1b6a645a2c
URI Parameters
HideShow
id
string (required) Example: bbd87743-73df-42d9-80b2-df1b6a645a2c

The ID of the strain to show.

Request
HideShow
Headers
Authorization: Token token="{your_token}"
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "strain": {
    "id": "bbd87743-73df-42d9-80b2-df1b6a645a2c"
    "name": "Jack Herer"
  }
}

Update Strain
PUT/strains/{id}

Example URI

PUT https://api.greenbits.com/api/v1/strains/bbd87743-73df-42d9-80b2-df1b6a645a2c
URI Parameters
HideShow
id
string (required) Example: bbd87743-73df-42d9-80b2-df1b6a645a2c

The ID of the strain to show.

Request
HideShow
Headers
Content-Type: application/json
Authorization: Token token="{your_token}"
Body
{
  "strain": {
    "id": "bbd87743-73df-42d9-80b2-df1b6a645a2c"
    "name": "Afgoo"
  }
}
Response  204

Generated by aglio on 25 Apr 2024