UNPKG

growthbook

Version:

The GrowthBook command-line interface (CLI) for working with the GrowthBook A/B testing, feature flagging, and experimentation platform

55 lines (54 loc) 3.01 kB
/** * GrowthBook REST API * GrowthBook offers a full REST API for interacting with the GrowthBook application. This is currently in **beta** as we add more authenticated API routes and features. Request data can use either JSON or Form data encoding (with proper `Content-Type` headers). All response bodies are JSON-encoded. The API base URL for GrowthBook Cloud is `https://api.growthbook.io`. For self-hosted deployments, it is the same as your API_HOST environment variable (defaults to `http://localhost:3100`). The rest of these docs will assume you are using GrowthBook Cloud. ## Authentication We support both the HTTP Basic and Bearer authentication schemes for convenience. You first need to generate a new Secret Key in GrowthBook by going to `Settings -> API Keys`. If using HTTP Basic auth, pass the Secret Key as the username and leave the password blank: ```bash curl https://api.growthbook.io/api/v1 \\ -u secret_abc123DEF456: # The \":\" at the end stops curl from asking for a password ``` If using Bearer auth, pass the Secret Key as the token: ```bash curl https://api.growthbook.io/api/v1 \\ -H \"Authorization: Bearer secret_abc123DEF456\" ``` ## Errors The API may return the following error status codes: - **400** - Bad Request - Often due to a missing required parameter - **401** - Unauthorized - No valid API key provided - **402** - Request Failed - The parameters are valid, but the request failed - **403** - Forbidden - Provided API key does not have the required access - **404** - Not Found - Unknown API route or requested resource - **429** - Too Many Requests - You exceeded the rate limit of 60 requests per minute. Try again later. - **5XX** - Server Error - Something went wrong on GrowthBook\'s end (these are rare) The response body will be a JSON object with the following properties: - **message** - Information about the error * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import type { Configuration } from './configuration'; import type { AxiosInstance, AxiosRequestConfig } from 'axios'; export declare const BASE_PATH: string; /** * * @export */ export declare const COLLECTION_FORMATS: { csv: string; ssv: string; tsv: string; pipes: string; }; /** * * @export * @interface RequestArgs */ export interface RequestArgs { url: string; options: AxiosRequestConfig; } /** * * @export * @class BaseAPI */ export declare class BaseAPI { protected basePath: string; protected axios: AxiosInstance; protected configuration: Configuration | undefined; constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance); } /** * * @export * @class RequiredError * @extends {Error} */ export declare class RequiredError extends Error { field: string; constructor(field: string, msg?: string); }