API Reference

Features

get

Use this endpoint to get the list of all features with their targeting rules.

Authorizations
Responses
application/json
all ofoptional

Standard response format for successful API calls

get
GET /features HTTP/1.1
Host: front.bucket.co
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "success": true,
  "features": [
    {
      "key": "text",
      "description": null,
      "createdAt": "text",
      "link": null,
      "targeting": {
        "version": 1,
        "rules": [
          "[Circular Reference]"
        ]
      },
      "config": {
        "version": 1,
        "variants": [
          "[Circular Reference]"
        ]
      }
    }
  ]
}

Rules schema

Attribute
Type
Description

filter

Filter

Object containing filtering rules which will evaluate against context object. Filter can be an instance of 5 different filter types described below.

Filter Schema

Attribute
Type
Desription

type

group

Filter group will evaluate by applying a logical operation to the array of filters provided

filters

Filter[]

Array of filters

operator

enum(and, or)

Logical operation

Features enabled

get

Use this endpoint to get the list of enabled features for the user. The response will contain the list of features that are enabled for the user.

Authorizations
Query parameters
contextobjectoptional

Context object has to be flattened and delimited by dots and provided as query parameters. Example:

context.company.id=42&context.user.id=99
keystring · min: 1 · max: 255optional

Feature key - unique identifier of the feature which you can find in app.bucket.co Example:

new-order-created
Responses
application/json
all ofoptional

Standard response format for successful API calls

get
function flattenObject(obj, prefix = '') {
  return Object.keys(obj).reduce((acc, key) => {
    const value = obj[key];
    const newKey = prefix ? `${prefix}.${encodeURIComponent(key)}` : encodeURIComponent(key);

    if (typeof value === 'object' && value !== null) {
      Object.assign(acc, flattenObject(value, newKey));
    } else {
      acc[newKey] = encodeURIComponent(value);
    }

    return acc;
  }, {});
}

function encodeQueryParams(deepObject) {
  const flattened = flattenObject(deepObject);
  return Object.keys(flattened)
    .map(key => `${key}=${flattened[key]}`)
    .join('&');
}

const params = {
  context: {
    user: {
      id: 'u2956',
      role: 'developer',
    },
    company: {
      id: 'c123',
      name: 'Example Inc',
      country: 'US',
    },
  },
};

// Perform the GET request using fetch
const res = await fetch(`https://front.bucket.co/features/enabled?${encodeQueryParams(params)}`, {
  method: 'GET',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer <your_public_key>`,
  },
});
const data = await res.json();
console.log(data);
{
  "success": true,
  "features": {
    "ANY_ADDITIONAL_PROPERTY": {
      "key": "text",
      "targetingVersion": 1,
      "isEnabled": true,
      "config": {
        "name": null,
        "version": 1,
        "default": true,
        "payload": null,
        "ruleEvaluationResults": [
          true
        ],
        "missingContextFields": [
          "text"
        ]
      },
      "ruleEvaluationResults": [
        true
      ],
      "missingContextFields": [
        "text"
      ]
    }
  },
  "remoteContextUsed": true
}

Features evaluated

get

Use this endpoint to get the list of all features evaluated for the user.

Authorizations
Query parameters
contextobjectoptional

Context object has to be flattened and delimited by dots and provided as query parameters. Example:

context.company.id=42&context.user.id=99
keystring · min: 1 · max: 255optional

Feature key - unique identifier of the feature which you can find in app.bucket.co Example:

new-order-created
Responses
application/json
all ofoptional

Standard response format for successful API calls

get
function flattenObject(obj, prefix = '') {
  return Object.keys(obj).reduce((acc, key) => {
    const value = obj[key];
    const newKey = prefix ? `${prefix}.${encodeURIComponent(key)}` : encodeURIComponent(key);

    if (typeof value === 'object' && value !== null) {
      Object.assign(acc, flattenObject(value, newKey));
    } else {
      acc[newKey] = encodeURIComponent(value);
    }

    return acc;
  }, {});
}

function encodeQueryParams(deepObject) {
  const flattened = flattenObject(deepObject);
  return Object.keys(flattened)
    .map(key => `${key}=${flattened[key]}`)
    .join('&');
}

const params = {
  context: {
    user: {
      id: 'u2956',
      role: 'developer',
    },
    company: {
      id: 'c123',
      name: 'Example Inc',
      country: 'US',
    },
  },
};

// Perform the GET request using fetch
const res = await fetch(`https://front.bucket.co/features/evaluated?${encodeQueryParams(params)}`, {
  method: 'GET',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer <your_public_key>',
  },
});
const data = await res.json();
console.log(data);
{
  "success": true,
  "features": {
    "ANY_ADDITIONAL_PROPERTY": {
      "key": "text",
      "targetingVersion": 1,
      "isEnabled": true,
      "config": {
        "name": null,
        "version": 1,
        "default": true,
        "payload": null,
        "ruleEvaluationResults": [
          true
        ],
        "missingContextFields": [
          "text"
        ]
      },
      "ruleEvaluationResults": [
        true
      ],
      "missingContextFields": [
        "text"
      ]
    }
  },
  "remoteContextUsed": true
}

Features events

post

Use this endpoint to send feature events to Bucket.

Authorizations
Body

Represents an event related to feature flag evaluation

actionstring · enumrequiredAvailable options:
keystring · min: 1 · max: 255required

Feature key - unique identifier of the feature which you can find in app.bucket.co Example:

new-order-created
targetingVersionnumberoptional

The version of the targeting rules. Every time when targeting rules are updated the version is incremented.

evalContextobjectoptional

Context object has to be flattened and delimited by dots and provided as query parameters. Example:

context.company.id=42&context.user.id=99
evalResultbooleanrequired

The result of the evaluation

evalRuleResultsboolean[]optional

The results of evaluation for each of the rules

evalMissingFieldsstring[]optional

The fields that were missing in the context for successful evaluation

Responses
application/json
objectoptional

Standard response format for successful API calls

post
POST /features/events HTTP/1.1
Host: front.bucket.co
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 179

[
  {
    "action": "evaluate-is-enabled",
    "key": "text",
    "targetingVersion": 1,
    "evalContext": {
      "user": {},
      "company": {}
    },
    "evalResult": true,
    "evalRuleResults": [
      true
    ],
    "evalMissingFields": [
      "text"
    ]
  }
]
{
  "success": true
}

User

post

Use this endpoint when you want to send user attributes to Bucket. If the user does not exist, it will be created. This endpoint is also used whenever you construct bucket client in any of the SDKs.

Authorizations
Body

Represents a user entity with their attributes and metadata

userIdstring · min: 1required

Unique identifier for the user

attributesobjectoptional

Additional attributes of the user

timestampstring · date-timeoptional

Timestamp associated with the user data

Responses
application/json
objectoptional

Standard response format for successful API calls

post
POST /user HTTP/1.1
Host: front.bucket.co
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 72

{
  "userId": "text",
  "attributes": {},
  "timestamp": "2025-04-17T17:10:39.931Z"
}
{
  "success": true
}

Company

post

Use this endpoint when you want to send company attributes to Bucket. If the company does not exist, it will be created. You can also use this endpoint to assign user to a company by including the user ID. This endpoint is also used whenever you construct bucket client in any of the SDKs.

Authorizations
Body

Represents a company entity with its attributes and associated user

userIdstring · min: 1optional

Identifier for the user linked to the company

companyIdstring · min: 1required

Unique identifier for the company

attributesobjectoptional

Additional attributes of the company

timestampstring · date-timeoptional

Timestamp associated with the company data

Responses
application/json
objectoptional

Standard response format for successful API calls

post
POST /company HTTP/1.1
Host: front.bucket.co
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 91

{
  "userId": "text",
  "companyId": "text",
  "attributes": {},
  "timestamp": "2025-04-17T17:10:39.931Z"
}
{
  "success": true
}

Event

post

Use this endpoint when you want to send a tracking events to Bucket.

Authorizations
Body

Represents a tracking event with associated user, company, and metadata

userIdstring · min: 1required

Identifier for the user initiating the event

eventstring · min: 1required

The name of the generated event

attributesobjectoptional

Additional event-related attributes

companyIdstring · min: 1optional

Identifier for the company linked to the event

timestampstring · date-timeoptional

Timestamp associated with the event

Responses
application/json
objectoptional

Standard response format for successful API calls

post
POST /event HTTP/1.1
Host: front.bucket.co
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 106

{
  "userId": "text",
  "event": "text",
  "attributes": {},
  "companyId": "text",
  "timestamp": "2025-04-17T17:10:39.931Z"
}
{
  "success": true
}

Feedback

post

Use this endpoint when you want to send feedback events to Bucket.

Authorizations
Body

Represents user feedback data with associated context and metadata

feedbackIdstring · min: 1optional

Unique identifier for updating existing feedback

userIdstring · min: 1required

Identifier of the user providing feedback

companyIdstring · min: 1optional

Identifier of the company linked to the feedback

promptIdstring · min: 10 · max: 40optional

Identifier of the feedback prompt

featureIdstring · min: 1 · max: 14optional

Identifier of the feature the feedback is related to

keystring · min: 1 · max: 255optional

Feature key - unique identifier of the feature which you can find in app.bucket.co Example:

new-order-created
questionstring · min: 1 · max: 256optional

In case the feedback is initiated by a prompt this will be the question which was asked

promptedQuestionstring · min: 1 · max: 256optional

In case the feedback is initiated by a prompt this will be the question which was asked

sourcestring · enumoptional

The source of the feedback

Available options:
scorenumber · max: 5optional

The score of the feedback

commentstring · min: 1 · max: 4000optional

The user's input

timestampstring · date-timeoptional

When the feedback was submitted

Responses
application/json
objectoptional

Standard response format for successful API calls

post
POST /feedback HTTP/1.1
Host: front.bucket.co
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 231

{
  "feedbackId": "text",
  "userId": "text",
  "companyId": "text",
  "promptId": "text",
  "featureId": "text",
  "key": "text",
  "question": "text",
  "promptedQuestion": "text",
  "source": "api",
  "score": 1,
  "comment": "text",
  "timestamp": "2025-04-17T17:10:39.931Z"
}
{
  "success": true
}

Bulk

post

Use this endpoint when you want to send multiple events to Bucket.

Authorizations
Body

A collection of different types of operations to be processed in bulk

itemsall ofoptional

A single item in a bulk operation request that can be of different types

Responses
application/json
objectoptional

Standard response format for successful API calls

post
POST /bulk HTTP/1.1
Host: front.bucket.co
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 88

[
  {
    "type": "user",
    "userId": "text",
    "attributes": {},
    "timestamp": "2025-04-17T17:10:39.931Z"
  }
]
{
  "success": true
}

Last updated

Was this helpful?