Categories

Categories allow you to group products in your storefront.

The Category object

The category object contains all the information about a category.

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier for the category.

  • Name
    title
    Type
    string
    Description

    The display title of the category.

  • Name
    product_ids
    Type
    array
    Description

    The product IDs contained in the category.

  • Name
    unlisted
    Type
    boolean
    Description

    Whether the category will be listed publicly on your storefront. If true, the category can only be found via a direct URL

  • Name
    image
    Type
    object
    Description
    Display image of the category.
    • Name
      id
      Type
      string
      Description

      Unique identifier for the image file.

    • Name
      url
      Type
      string
      Description

      URL to the image hosted on Selly

    • Name
      metadata
      Type
      object
      Description
      Extra metadata for the file.
      • Name
        size
        Type
        integer
        Description

        Size of the file in bytes.

      • Name
        filename
        Type
        string
        Description

        File name of the file, including the extension.

      • Name
        mime_type
        Type
        string
        Description

        MIME type of the file.

  • Name
    created_at
    Type
    timestamp
    Description

    Timestamp of when the category was created.

  • Name
    updated_at
    Type
    timestamp
    Description

    Timestamp of when the category was last updated.


GET/v2/categories

List all categories

This endpoint allows you to retrieve a paginated list of all your categories. By default, a maximum of 20 categories are shown per page.

Optional attributes

  • Name
    page
    Type
    integer
    Description

    The page number. Defaults to 1

  • Name
    per_page
    Type
    integer
    Description

    Records per page. Defaults to 20.

Request

GET
/api/v2/categories
curl -G https://selly.io/api/v2/categories \
  -H "Authorization: Bearer {token}" \
  -d page=1

Response

[
  {
    "id": "1dd671f4",
    "title": "Demo category",
    "product_ids": [
      "100bcf1e"
    ],
    "image": {
      "id": "55e68f9900c08f1dea6aec2ffc9c153856a91d5c/b65fcd4508226e9774445ebb4495048756750738",
      "storage": "cdn",
      "metadata": {
        "size": 3463,
        "filename": "logo.png",
        "mime_type": "image/png"
      },
      "url": "https://cdn.selly.io/cd2de339c0a605dedf29aecd44d3feb002842e60/68747470733a2f2f73656c6c792e6e7963332e6469676974616c6f6365616e7370616365732e636f6d2f63616368652f353565363866393930306330386631646561366165633266666339633135333835366139316435632f6236356663643435303832323665393737343434356562623434393530343837353637"
    },
    "unlisted": true,
    "created_at": "2023-12-25T15:09:13.000+00:00",
    "updated_at": "2023-12-25T15:31:40.000+00:00"
  },
  {
    "id": "5w8QhZqx",
    // ...
  }
]

GET/v2/categories/:id

Retrieve a category

This endpoint allows you to retrieve a category by providing the category id. Refer to the list at the top of this page to see which properties are included with category objects.

Request

GET
/api/v2/categories/:id
curl https://selly.io/api/v2/categories/1dd671f4 \
  -H "Authorization: Bearer {token}"

Response

{
  "id": "1dd671f4",
  "title": "Demo category",
  "product_ids": [
    "100bcf1e"
  ],
  "image": {
    "id": "55e68f9900c08f1dea6aec2ffc9c153856a91d5c/b65fcd4508226e9774445ebb4495048756750738",
    "storage": "cdn",
    "metadata": {
      "size": 3463,
      "filename": "logo.png",
      "mime_type": "image/png"
    },
    "url": "https://cdn.selly.io/cd2de339c0a605dedf29aecd44d3feb002842e60/68747470733a2f2f73656c6c792e6e7963332e6469676974616c6f6365616e7370616365732e636f6d2f63616368652f353565363866393930306330386631646561366165633266666339633135333835366139316435632f6236356663643435303832323665393737343434356562623434393530343837353637"
  },
  "unlisted": true,
  "created_at": "2023-12-25T15:09:13.000+00:00",
  "updated_at": "2023-12-25T15:31:40.000+00:00"
}

POST/v2/categories

Create a category

This endpoint allows you to create a category.

Request

POST
/api/v2/categories
curl -X POST https://selly.io/api/v2/categories \
  -H "Authorization: Bearer {token}" \
  -d title="Demo category" \
  -d product_ids[0]="100bcf1e"

Response

{
  "id": "1dd671f4",
  "title": "Demo category",
  "product_ids": [
    "100bcf1e"
  ],
  "image": null,
  "unlisted": true,
  "created_at": "2019-12-25T15:09:13.000+00:00",
  "updated_at": "2019-12-25T15:31:40.000+00:00"
}

PUT/v2/categories/:id

Update a category

This endpoint allows you to update a category.

Request

PUT
/api/v2/categories/:id
curl -X PUT https://selly.io/api/v2/categories/1dd671f4 \
  -H "Authorization: Bearer {token}" \
  -d title="New title"

Response

{
  "id": "1dd671f4",
  "title": "New title",
  "product_ids": [
    "100bcf1e"
  ],
  "image": {
    "id": "55e68f9900c08f1dea6aec2ffc9c153856a91d5c/b65fcd4508226e9774445ebb4495048756750738",
    "storage": "cdn",
    "metadata": {
      "size": 3463,
      "filename": "logo.png",
      "mime_type": "image/png"
    },
    "url": "https://cdn.selly.io/cd2de339c0a605dedf29aecd44d3feb002842e60/68747470733a2f2f73656c6c792e6e7963332e6469676974616c6f6365616e7370616365732e636f6d2f63616368652f353565363866393930306330386631646561366165633266666339633135333835366139316435632f6236356663643435303832323665393737343434356562623434393530343837353637"
  },
  "unlisted": true,
  "created_at": "2023-12-25T15:09:13.000+00:00",
  "updated_at": "2023-12-26T15:31:40.000+00:00"
}

DELETE/v2/categories/:id

Delete a category

This endpoint allows you to delete a category. Note: This will permanently delete the category.

Request

DELETE
/api/v2/categories/:id
curl -X DELETE https://selly.io/api/v2/categories/1dd671f4 \
  -H "Authorization: Bearer {token}" \