sdk

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ServerList = []string{

	"https://api.growthbook.io/api",

	"https://{domain}/api",
}

ServerList contains the list of servers available to the SDK

Functions

func Bool

func Bool(b bool) *bool

Bool provides a helper function to return a pointer to a bool

func Float32

func Float32(f float32) *float32

Float32 provides a helper function to return a pointer to a float32

func Float64

func Float64(f float64) *float64

Float64 provides a helper function to return a pointer to a float64

func Int

func Int(i int) *int

Int provides a helper function to return a pointer to an int

func Int64

func Int64(i int64) *int64

Int64 provides a helper function to return a pointer to an int64

func Pointer

func Pointer[T any](v T) *T

Pointer provides a helper function to return a pointer to a type

func String

func String(s string) *string

String provides a helper function to return a pointer to a string

Types

type AnalyticsExplorations

type AnalyticsExplorations struct {
	// contains filtered or unexported fields
}

func (*AnalyticsExplorations) RunDataSource

RunDataSource - Create a Data Source based visualization

func (*AnalyticsExplorations) RunFactTable

RunFactTable - Run a Fact Table based visualization

func (*AnalyticsExplorations) RunMetric

RunMetric - Create a Metric based visualization

type Archetypes

type Archetypes struct {
	// contains filtered or unexported fields
}

Archetypes allow you to simulate the result of targeting rules on pre-set user attributes

func (*Archetypes) Create

Create a single archetype

func (*Archetypes) DeleteArchetype

DeleteArchetype - Deletes a single archetype

func (*Archetypes) GetArchetype

GetArchetype - Get a single archetype

func (*Archetypes) ListArchetypes

func (s *Archetypes) ListArchetypes(ctx context.Context, opts ...operations.Option) (*operations.ListArchetypesResponse, error)

ListArchetypes - Get the organization's archetypes

func (*Archetypes) Update

Update a single archetype

type Attributes

type Attributes struct {
	// contains filtered or unexported fields
}

Attributes - Used when targeting feature flags and experiments.

func (*Attributes) Create

Create a new attribute

func (*Attributes) DeleteAttribute

DeleteAttribute - Deletes a single attribute

func (*Attributes) ListAttributes

ListAttributes - Get the organization's attributes

func (*Attributes) Update

Update an attribute

type CodeReferences

type CodeReferences struct {
	// contains filtered or unexported fields
}

CodeReferences - Intended for use with our code reference CI utility, [`gb-find-code-refs`](https://github.com/growthbook/gb-find-code-refs).

func (*CodeReferences) GetForFeature

GetForFeature - Get list of code references for a single feature id

func (*CodeReferences) List

List - Get list of all code references for the current organization

func (*CodeReferences) Submit

Submit list of code references

type ConfigRevisions

type ConfigRevisions struct {
	// contains filtered or unexported fields
}

ConfigRevisions - Draft revisions for configs, including value and schema edits, schema import (JSON Schema / TypeScript / inferred), approvals, and lifecycle (publish, discard, revert). Publishing a schema change cascades the "base wins" normalization to descendant configs; a publish that removes or retypes fields descendants still use soft-blocks with a 422 unless `?ignoreWarnings=true`. Pass `version: "new"` on edit endpoints to auto-create a draft.

func (*ConfigRevisions) Archive

Archive - Stage an archive/unarchive in a draft revision Stages an archive or unarchive on the draft. Pass `version: "new"` to auto-create a draft. Archived configs can be permanently deleted via `DELETE /configs/{key}` once the archive is published.

func (*ConfigRevisions) Create

Create a draft revision Creates a new draft revision branched from the current live config. A config can have multiple concurrent drafts; use this to start an isolated line of edits.

func (*ConfigRevisions) DeleteProjection

DeleteProjection - Remove a config's per-source render projection on a draft Stages removal of the `source` projection from `renderProjections` on the draft (the canonical schema is unchanged). Published through the normal flow. Pass `version: "new"` to auto-create a draft.

func (*ConfigRevisions) Discard

Discard a draft revision Permanently discards a draft revision. Only open revisions (not merged or already-discarded) can be discarded.

func (*ConfigRevisions) GetConfigRevision

GetConfigRevision - Get a single config revision Returns the revision at the specified version for this config. Use `GET /configs-revisions/{key}/latest` for the most recent active draft.

func (*ConfigRevisions) Latest

Latest - Get the most recent active draft revision Returns the most recently updated open (non-merged, non-discarded) revision for the config. Returns 404 if there is no active draft. Pass `mine=true` to restrict to drafts authored by the calling user (requires a user-scoped API key).

func (*ConfigRevisions) ListConfigRevisions

ListConfigRevisions - List config revisions across the organization Returns a paginated list of revisions across all configs in the organization, sorted newest-first. Optionally filtered by config, status, author, or the calling user's involvement.

func (*ConfigRevisions) ListForConfig

ListForConfig - List revisions for a config Returns a paginated list of revisions for this config, sorted newest-first. Optionally filtered by status, author, or the calling user's involvement.

func (*ConfigRevisions) MergeStatus

MergeStatus - Get merge status for a draft revision Runs a dry-run merge of the draft against the current live config and returns any conflicts. Use this before publishing to preview changes and detect conflicting edits.

func (*ConfigRevisions) Publish

Publish a draft revision Publishes a draft revision, making it the live state of the config. Blocked if the org requires approvals and the revision is not approved (callers with the bypass-approval permission may still publish). Publishing a schema change cascades the 'base wins' normalization to descendant configs.

func (*ConfigRevisions) Rebase

Rebase a draft revision onto the current live config Updates the draft's base snapshot to the current live state, applying the draft's changes on top. Supply `conflictResolutions` to resolve any conflicting fields. Strategies are `overwrite` (use the draft's value) or `discard` (keep the live value).

func (*ConfigRevisions) RecallReview

RecallReview - Recall a review request Pulls a revision in review (`pending-review`, `changes-requested`, or `approved`) back to `draft`, clearing existing reviews and disarming any auto-publish-on-approval.

func (*ConfigRevisions) Reopen

Reopen a discarded revision Returns a previously discarded revision to `draft` status so it can be edited and published again. Only discarded revisions can be reopened.

func (*ConfigRevisions) RequestReview

RequestReview - Request review for a draft revision Moves the draft from `draft` into `pending-review`. Notifies reviewers per the org's approval-flow settings.

Set `autoPublishOnApproval` to `true` to publish the revision automatically the moment it is approved. This requires the org to have auto-publish-on-approval enabled and the caller to have publish permission on the config.

func (*ConfigRevisions) Revert

Revert the config to a prior revision Creates a new draft (or immediately publishes) whose content matches the specified historical revision. Defaults to creating a draft; when the org enables 'reverts bypass approval' it defaults to publishing immediately. Pass `strategy` to override.

func (*ConfigRevisions) SchedulePublish

SchedulePublish - Schedule (or cancel) a deferred publish Arms a revision to publish automatically at a future time. Pass `scheduledPublishAt` as an RFC3339 timestamp in the future to arm, or `null` to cancel a pending schedule. Requires the `scheduled-revisions` commercial feature and publish permission on the config. A draft that still requires approval must request review first (or be armed with `bypassApproval` by a caller who can bypass).

func (*ConfigRevisions) SetMetadata

SetMetadata - Update config metadata in a draft revision Stages metadata changes (name, owner, description, project, lineage parent, extensibility) on the draft. Pass `version: "new"` to auto-create a draft. The change is only applied to the live config when the revision is merged.

func (*ConfigRevisions) SetProjection

SetProjection - Set (or update) a config's per-source render projection on a draft Stages a per-source render projection on the draft, AND the schema it implies. Provide a named `schema` source (`{ type: "typescript" | "protobuf" | "python" | "go" | "rust" | "json-schema", value }`) for the consuming codebase identified by `source`: GrowthBook derives the config's canonical schema from it (so the change projects into the Config) and captures that source's named-type structure under `renderProjections[source]`. Both are staged on the draft and published through the normal flow. Pass `version: "new"` to auto-create a draft. Lossy conversions degrade with `warnings`.

func (*ConfigRevisions) SetSchema

SetSchema - Update or import the schema of a config draft revision Stages this config's field schema on the draft. Provide exactly ONE source: - `schema`: a schema document — `{ type: "json-schema", value }` (a JSON Schema object) or `{ type: "typescript", value }` (TypeScript source). **JSON Schema is the recommended ("happy path") format** — it is the canonical pivot, preserves nested objects/arrays, and resolves local `$ref`/`$defs` (so generator output with referenced types works). `typescript` is a best-effort convenience parser. All conversions are lossy-by-design and degrade exotic constructs to permissive types WITH warnings (returned in `warnings`). - `infer: true`: derive the schema from the draft's value.

Fields whose key a published ancestor already owns follow "base wins": an identical re-declaration is stripped with a `redundant-declaration` warning; one with a differing definition is rejected. Pass `version: "new"` to auto-create a draft.

func (*ConfigRevisions) SetValue

SetValue - Update the value of a config draft revision Stages a new `value` (this config's own JSON object) on the draft. Pass `version: "new"` to auto-create a draft. A `@config:` inheritance entry in the value is rejected — express lineage via the `parent`/`extends` metadata fields instead. Configs are environment-agnostic: there is no per-environment override (use a Constant for that).

Inheritance is a deep (targeted) patch: this value is merged onto the resolved parent recursively, key by key — restate only the leaves you want to change and the rest are inherited. Arrays and scalars replace wholesale, `null` is a value (it does not delete a key), and a value composed from a constant via `$extends` is applied whole.

Set `inferSchemaIfMissing: true` to derive and stage a field schema from the value when the config has none yet.

func (*ConfigRevisions) SubmitReview

SubmitReview - Submit a review on a draft revision Submits an `approve`, `request-changes`, or `comment` review on the revision. Authors and contributors cannot submit `approve` reviews on their own drafts when the org has `blockSelfApproval` enabled.

When `decision` is `approve` and the revision has `autoPublishOnApproval` enabled, the revision is automatically published after approval. The response includes `autoPublished: true` when this happens. Pass `skipAutoPublish: true` to approve without triggering auto-publish.

type Configs

type Configs struct {
	// contains filtered or unexported fields
}

Configs - Reusable, typed, inheritable JSON objects referenced from feature flag values as `@config:key`. A config carries a field `schema` (with TypeScript/JSON Schema import-export) and a lineage `parent`; it resolves like a `json` constant, composed via `$extends`. Inheritance is expressed via `parent`, never an in-value `@config:` entry. Schema fields colliding with a published ancestor's key follow 'base wins': identical re-declarations are stripped with a warning, differing ones are rejected.

func (*Configs) ArchiveConfig

ArchiveConfig - Archive a single config Archives a config. A child config (including an environment/project override) is archived outright when its live value is an empty patch or nothing serves it; when it IS actively serving a value, this returns a 422 soft warning — re-submit with `?ignoreWarnings=true` to proceed. A root config that is still referenced by a feature or another config cannot be archived (400).

func (*Configs) Create

Create a single config

func (*Configs) DeleteConfig

DeleteConfig - Delete a single config

func (*Configs) GetConfig

GetConfig - Get a single config

func (*Configs) GetKeyUsage

GetKeyUsage - Get the feature rules and default values implementing each key Lists every feature rule and default value that overrides a key of this config's lineage family, so you can see which keys are implemented and where.

func (*Configs) GetLineage

GetLineage - Get the full lineage (family tree) for a config

func (*Configs) GetReferences

GetReferences - Get features and configs that reference this config

func (*Configs) GetSchema

GetSchema - Export a config's schema

func (*Configs) ListConfigs

ListConfigs - Get all configs

func (*Configs) LockConfig

LockConfig - Lock a config at its current published revision Freezes the config at its current published (merged) revision. While locked, no change can be published past that revision — publish, revert-to-publish, direct update, scheduled publish, and archive are all blocked (drafts may still be created and edited). The pinned revision is returned as `lockedRevision` for reproducible build pinning. Unlocking requires the `bypassApprovalChecks` permission.

func (*Configs) UnarchiveConfig

UnarchiveConfig - Unarchive a single config

func (*Configs) UnlockConfig

UnlockConfig - Unlock a config Clears the lock so changes can be published again. Requires the `bypassApprovalChecks` permission on the config's project.

func (*Configs) UpdateConfig

UpdateConfig - Partially update a single config

func (*Configs) VerifySchema

VerifySchema - Verify a config's schema against a source (drift check)

type ConstantRevisions

type ConstantRevisions struct {
	// contains filtered or unexported fields
}

ConstantRevisions - Draft revisions for constants, including pending changes, approvals, and lifecycle (publish, discard, revert). Pass `version: "new"` on edit endpoints to auto-create a draft.

func (*ConstantRevisions) Archive

Archive - Stage an archive/unarchive in a draft revision Stages an archive or unarchive on the draft. Pass `version: "new"` to auto-create a draft. Archived constants can be permanently deleted via `DELETE /constants/{key}` once the archive is published.

func (*ConstantRevisions) Create

Create a draft revision Creates a new draft revision branched from the current live constant. A constant can have multiple concurrent drafts; use this to start an isolated line of edits.

func (*ConstantRevisions) Discard

Discard a draft revision Permanently discards a draft revision. Only open revisions (not merged or already-discarded) can be discarded.

func (*ConstantRevisions) GetConstantRevision

GetConstantRevision - Get a single constant revision Returns the revision at the specified version for this constant. Use `GET /constants-revisions/{key}/latest` for the most recent active draft.

func (*ConstantRevisions) Latest

Latest - Get the most recent active draft revision Returns the most recently updated open (non-merged, non-discarded) revision for the constant. Returns 404 if there is no active draft. Pass `mine=true` to restrict to drafts authored by the calling user (requires a user-scoped API key).

func (*ConstantRevisions) ListConstantRevisions

ListConstantRevisions - List constant revisions across the organization Returns a paginated list of revisions across all constants in the organization, sorted newest-first. Optionally filtered by constant, status, author, or the calling user's involvement.

func (*ConstantRevisions) ListForConstant

ListForConstant - List revisions for a constant Returns a paginated list of revisions for this constant, sorted newest-first. Optionally filtered by status, author, or the calling user's involvement.

func (*ConstantRevisions) MergeStatus

MergeStatus - Get merge status for a draft revision Runs a dry-run merge of the draft against the current live constant and returns any conflicts. Use this before publishing to preview changes and detect conflicting edits.

func (*ConstantRevisions) Publish

Publish a draft revision Publishes a draft revision, making it the live state of the constant. Blocked if the org requires approvals and the revision is not approved (callers with the bypass-approval permission may still publish).

func (*ConstantRevisions) Rebase

Rebase a draft revision onto the current live constant Updates the draft's base snapshot to the current live state, applying the draft's changes on top. Supply `conflictResolutions` to resolve any conflicting fields. Strategies are `overwrite` (use the draft's value) or `discard` (keep the live value).

func (*ConstantRevisions) RequestReview

RequestReview - Request review for a draft revision Moves the draft from `draft` into `pending-review`. Notifies reviewers per the org's approval-flow settings.

Set `autoPublishOnApproval` to `true` to publish the revision automatically the moment it is approved. This requires the org to have auto-publish-on-approval enabled and the caller to have publish permission on the constant.

func (*ConstantRevisions) Revert

Revert the constant to a prior revision Creates a new draft (or immediately publishes) whose content matches the specified historical revision. Defaults to creating a draft; when the org enables 'reverts bypass approval' it defaults to publishing immediately. Pass `strategy` to override.

func (*ConstantRevisions) SetMetadata

SetMetadata - Update constant metadata in a draft revision Stages metadata changes (name, owner, description, project) on the draft. Pass `version: "new"` to auto-create a draft. The change is only applied to the live constant when the revision is merged.

func (*ConstantRevisions) SetValue

SetValue - Update the value of a constant draft revision Stages a new default `value` and/or per-environment `environmentValues` on the draft. At least one must be supplied. Pass `version: "new"` to auto-create a draft. The value must match the constant's type (valid JSON for `json` constants).

func (*ConstantRevisions) SubmitReview

SubmitReview - Submit a review on a draft revision Submits an `approve`, `request-changes`, or `comment` review on the revision. Authors and contributors cannot submit `approve` reviews on their own drafts when the org has `blockSelfApproval` enabled.

When `decision` is `approve` and the revision has `autoPublishOnApproval` enabled, the revision is automatically published after approval. The response includes `autoPublished: true` when this happens. Pass `skipAutoPublish: true` to approve without triggering auto-publish.

type Constants

type Constants struct {
	// contains filtered or unexported fields
}

Constants - Reusable named values referenced from feature flag values as `@const:key` and resolved into the SDK payload at build time. String constants are interpolated via `{{ @const:key }}`; JSON (object) constants are composed via an `$extends` array.

func (*Constants) ArchiveConstant

ArchiveConstant - Archive a single constant

func (*Constants) Create

Create a single constant

func (*Constants) DeleteConstant

DeleteConstant - Delete a single constant

func (*Constants) GetConstant

GetConstant - Get a single constant

func (*Constants) GetReferences

GetReferences - Get features and constants that reference this constant

func (*Constants) ListConstants

ListConstants - Get all constants

func (*Constants) UnarchiveConstant

UnarchiveConstant - Unarchive a single constant

func (*Constants) UpdateConstant

UpdateConstant - Partially update a single constant

type ContextualBanditQueries

type ContextualBanditQueries struct {
	// contains filtered or unexported fields
}

func (*ContextualBanditQueries) CreateContextualBanditQuery

CreateContextualBanditQuery - Create a single contextualBanditQuery

func (*ContextualBanditQueries) DeleteContextualBanditQuery

DeleteContextualBanditQuery - Delete a single contextualBanditQuery

func (*ContextualBanditQueries) GetContextualBanditQuery

GetContextualBanditQuery - Get a single contextualBanditQuery

func (*ContextualBanditQueries) ListContextualBanditQueries

ListContextualBanditQueries - Get all contextualBanditQueries

func (*ContextualBanditQueries) UpdateContextualBanditQuery

UpdateContextualBanditQuery - Update a single contextualBanditQuery

type ContextualBandits

type ContextualBandits struct {
	// contains filtered or unexported fields
}

func (*ContextualBandits) CreateContextualBandit

CreateContextualBandit - Create a single contextualBandit

func (*ContextualBandits) DeleteContextualBanditLinkedFeature

DeleteContextualBanditLinkedFeature - Unlink a feature from a Contextual Bandit Detaches a feature from this contextual bandit by removing it from the bandit's linked-feature list and cancelling any queued draft auto-publish. The feature's `contextual-bandit-ref` rule itself is left untouched.

func (*ContextualBandits) GetContextualBandit

GetContextualBandit - Get a single contextualBandit

func (*ContextualBandits) GetContextualBanditCurrentWeights

GetContextualBanditCurrentWeights - Get current Contextual Bandit leaf weights and latest event

func (*ContextualBandits) GetContextualBanditEvent

GetContextualBanditEvent - Get a single Contextual Bandit weight-update event

func (*ContextualBandits) GetContextualBanditLinkedFeatures

GetContextualBanditLinkedFeatures - Get features linked to a Contextual Bandit Returns the features that reference this contextual bandit via a `contextual-bandit-ref` rule, enriched with each feature's live/draft state, per-environment rule state, and variation values. Same payload the GrowthBook UI uses to render the Linked Features section.

func (*ContextualBandits) GetContextualBanditResults

GetContextualBanditResults - Get latest Contextual Bandit results Returns the latest contextual-bandit stats engine output (per-context responses, the context-to-leaf map, and per-leaf aggregated stats), the overall (marginal) variation weights across all contexts, the SRM of the most recent run, and the status of the most recent snapshot run for the contextual bandit. Same payload the GrowthBook UI uses to render the contextual bandit results table.

func (*ContextualBandits) GetContextualBanditSnapshot

GetContextualBanditSnapshot - Get a single Contextual Bandit snapshot

func (*ContextualBandits) ListContextualBanditEvents

ListContextualBanditEvents - List Contextual Bandit weight-update events

func (*ContextualBandits) ListContextualBanditSnapshots

ListContextualBanditSnapshots - List Contextual Bandit snapshots

func (*ContextualBandits) ListContextualBandits

ListContextualBandits - Get all contextualBandits

func (*ContextualBandits) RefreshContextualBandit

RefreshContextualBandit - Trigger a Contextual Bandit snapshot refresh

func (*ContextualBandits) StartContextualBandit

StartContextualBandit - Start a Contextual Bandit

func (*ContextualBandits) StopContextualBandit

StopContextualBandit - Stop a Contextual Bandit

func (*ContextualBandits) UpdateContextualBandit

UpdateContextualBandit - Update a single contextualBandit

type CustomFields

type CustomFields struct {
	// contains filtered or unexported fields
}

func (*CustomFields) CreateCustomField

CreateCustomField - Create a single customField

func (*CustomFields) DeleteCustomField

DeleteCustomField - Delete a single customField

func (*CustomFields) GetCustomField

GetCustomField - Get a single customField

func (*CustomFields) ListCustomFields

ListCustomFields - Get all custom fields

func (*CustomFields) UpdateCustomField

UpdateCustomField - Update a single customField

type CustomHooks

type CustomHooks struct {
	// contains filtered or unexported fields
}

CustomHooks - Sandboxed JavaScript validation hooks that run when features, configs, or their revisions are saved or published. Throwing an Error blocks the save; `addWarning(msg)` raises a soft warning. Hooks are scoped by projects, or pinned to a single feature/config via `entityType`/`entityId`; a config-scoped hook also runs for every config inheriting from it (its whole descendant lineage). Scope can be retargeted on update (or cleared with nulls). Requires an enterprise plan; not available on GrowthBook Cloud.

func (*CustomHooks) Create

Create a single custom hook

func (*CustomHooks) DeleteCustomHook

DeleteCustomHook - Delete a single custom hook

func (*CustomHooks) GetCustomHook

GetCustomHook - Get a single custom hook

func (*CustomHooks) ListCustomHooks

ListCustomHooks - Get all custom hooks

func (*CustomHooks) ListHistory

ListHistory - List a custom hook's version history

func (*CustomHooks) RevertCustomHook

RevertCustomHook - Revert a custom hook to a previous version

func (*CustomHooks) TestCustomHook

TestCustomHook - Dry-run hook code in the sandbox

func (*CustomHooks) UpdateCustomHook

UpdateCustomHook - Partially update a single custom hook

type Dashboards

type Dashboards struct {
	// contains filtered or unexported fields
}

func (*Dashboards) CreateDashboard

CreateDashboard - Create a single dashboard

func (*Dashboards) DeleteDashboard

DeleteDashboard - Delete a single dashboard

func (*Dashboards) GetDashboard

GetDashboard - Get a single dashboard

func (*Dashboards) ListDashboards

func (s *Dashboards) ListDashboards(ctx context.Context, opts ...operations.Option) (*operations.ListDashboardsResponse, error)

ListDashboards - Get all dashboards

func (*Dashboards) ListForExperiment

ListForExperiment - Get all dashboards for an experiment

func (*Dashboards) UpdateDashboard

UpdateDashboard - Update a single dashboard

type DataSources

type DataSources struct {
	// contains filtered or unexported fields
}

DataSources - How GrowthBook connects and queries your data, including cached database schema metadata (information schemas) for tables and columns.

func (*DataSources) GetDataSource

GetDataSource - Get a single data source

func (*DataSources) GetInformationSchema

GetInformationSchema - Get a Data Source's Information Schema Returns cached database schema metadata for a data source, including databases, schemas, and tables. The information schema is automatically created when a SQL-based data source is added. Not all data source types support information schemas.

func (*DataSources) GetInformationSchemaTable

GetInformationSchemaTable - Get a single Information Schema Table by id Returns cached metadata for a specific table in the Data Source, including columns and their data types. Not all data source types support information schemas.

func (*DataSources) ListDataSources

ListDataSources - Get all data sources

type Dimensions

type Dimensions struct {
	// contains filtered or unexported fields
}

Dimensions used during experiment analysis

func (*Dimensions) Create

Create a single dimension

func (*Dimensions) DeleteDimension

DeleteDimension - Deletes a single dimension

func (*Dimensions) GetDimension

GetDimension - Get a single dimension

func (*Dimensions) ListDimensions

ListDimensions - Get all dimensions

func (*Dimensions) UpdateDimension

UpdateDimension - Update a single dimension

type Environments

type Environments struct {
	// contains filtered or unexported fields
}

Environments - GrowthBook comes with one environment by default (production), but you can add as many as you need. When used with feature flags, you can enable/disable feature flags on a per-environment basis.

func (*Environments) Create

Create a new environment

func (*Environments) DeleteEnvironment

DeleteEnvironment - Deletes a single environment

func (*Environments) ListEnvironments

func (s *Environments) ListEnvironments(ctx context.Context, opts ...operations.Option) (*operations.ListEnvironmentsResponse, error)

ListEnvironments - Get the organization's environments

func (*Environments) Update

Update an environment

type ExperimentTemplates

type ExperimentTemplates struct {
	// contains filtered or unexported fields
}

func (*ExperimentTemplates) BulkImportExperimentTemplates

BulkImportExperimentTemplates - Bulk create or update experiment templates

func (*ExperimentTemplates) CreateExperimentTemplate

CreateExperimentTemplate - Create a single experimentTemplate

func (*ExperimentTemplates) DeleteExperimentTemplate

DeleteExperimentTemplate - Delete a single experimentTemplate

func (*ExperimentTemplates) GetExperimentTemplate

GetExperimentTemplate - Get a single experimentTemplate

func (*ExperimentTemplates) ListExperimentTemplates

ListExperimentTemplates - Get all experimentTemplates

func (*ExperimentTemplates) UpdateExperimentTemplate

UpdateExperimentTemplate - Update a single experimentTemplate

type Experiments

type Experiments struct {
	// contains filtered or unexported fields
}

Experiments (A/B Tests)

func (*Experiments) CompleteStartChecklist

CompleteStartChecklist - Mark manual pre-launch checklist items complete

func (*Experiments) Create

Create a single experiment

func (*Experiments) CreateSnapshot

CreateSnapshot - Create Experiment Snapshot

func (*Experiments) DeleteVariationScreenshot

DeleteVariationScreenshot - Delete a variation screenshot

func (*Experiments) GetExperiment

GetExperiment - Get a single experiment

func (*Experiments) GetStartChecklist

GetStartChecklist - Get an experiment pre-launch checklist status

func (*Experiments) ListExperiments

ListExperiments - Get all experiments

func (*Experiments) ListNames

ListNames - Get a list of experiments with names and ids

func (*Experiments) ListResults

ListResults - Get latest results for many experiments Returns the latest non-dimension snapshot for each experiment matching the filters. Use this to scan results across a portfolio in one call.

Pagination semantics: - `total` is the count of experiments matching the filters. - `count` is the length of the returned `experimentResults` array. - Experiments without a completed snapshot are omitted from `experimentResults`, so `count` may be less than the page slice and a page may legitimately return `count: 0` while `hasMore: true`. - `hasMore` and `nextOffset` advance over experiments matching the filters, not over returned results.

Use the per-experiment `GET /experiments/{id}/results` endpoint to inspect specific phases or dimensions.

func (*Experiments) ModifyTemporaryRollout

ModifyTemporaryRollout - Modify temporary rollout status for a stopped experiment

func (*Experiments) Results

Results - Get results for an experiment

func (*Experiments) Start

Start - Start/Stage an experiment Starts an experiment or stages it for a future start if a `statusUpdateSchedule` is set on the experiment.

func (*Experiments) Stop

Stop an experiment

func (*Experiments) UpdateExperiment

UpdateExperiment - Update a single experiment

func (*Experiments) UploadVariationScreenshot

UploadVariationScreenshot - Upload a variation screenshot

type FactMetrics

type FactMetrics struct {
	// contains filtered or unexported fields
}

FactMetrics - Fact Metrics are metrics built on top of Fact Table definitions

func (*FactMetrics) Create

Create a single fact metric

func (*FactMetrics) CreateAnalysis

CreateAnalysis - Create a fact metric analysis

func (*FactMetrics) DeleteFactMetric

DeleteFactMetric - Deletes a single fact metric

func (*FactMetrics) GetFactMetric

GetFactMetric - Get a single fact metric

func (*FactMetrics) ListFactMetrics

ListFactMetrics - Get all fact metrics

func (*FactMetrics) UpdateFactMetric

UpdateFactMetric - Update a single fact metric

type FactTables

type FactTables struct {
	// contains filtered or unexported fields
}

FactTables - Fact Tables describe the shape of your data warehouse tables

func (*FactTables) BulkImport

BulkImport - Bulk import fact tables, filters, and metrics

func (*FactTables) Create

Create a single fact table

func (*FactTables) CreateFilter

CreateFilter - Create a single fact table filter

func (*FactTables) DeleteFactTable

DeleteFactTable - Deletes a single fact table

func (*FactTables) DeleteFilter

DeleteFilter - Deletes a single fact table filter

func (*FactTables) GetAggregatedFactTables

GetAggregatedFactTables - Get the materialization status of a fact table's shared daily aggregated tables

func (*FactTables) GetAggregatedTableRun

GetAggregatedTableRun - Get a single aggregated table run

func (*FactTables) GetFactTable

GetFactTable - Get a single fact table

func (*FactTables) GetFilter

GetFilter - Get a single fact filter

func (*FactTables) ListAggregatedTableRuns

ListAggregatedTableRuns - List aggregated table runs

func (*FactTables) ListFactTables

ListFactTables - Get all fact tables

func (*FactTables) ListFilters

ListFilters - Get all filters for a fact table

func (*FactTables) RefreshAggregatedFactTable

RefreshAggregatedFactTable - Force a refresh or full restate of a fact table's shared daily aggregated tables

func (*FactTables) UpdateFactTable

UpdateFactTable - Update a single fact table

func (*FactTables) UpdateFilter

UpdateFilter - Update a single fact table filter

type FeatureRevisions

type FeatureRevisions struct {
	// contains filtered or unexported fields
}

FeatureRevisions - Draft revisions for feature flags, including rules, scheduling, and approval workflows.

Revision `rules` is a flat array with per-rule scope fields.

func (*FeatureRevisions) AddLogComment

AddLogComment - Edit the comment text of an owned log entry Author of a `Comment`, `Approved`, or `Requested Changes` log entry can rewrite its comment text. The entry's action and other audit-trail metadata remain immutable; this only mutates `value.comment`. Other audit events (e.g. `Review Requested`, system events) are not editable.

func (*FeatureRevisions) AddRule

AddRule - Add a rule to a draft revision Appends a new rule to the revision's rule list. Supply `allEnvironments: true` on the rule to target all environments, or `environments: [...]` to scope to specific ones.

**Scheduling:** For `force` and `rollout` rules, attach a schedule via `rampSchedule` (multi-step ramp) or `schedule` (simple start/end window) — these create standalone ramp actions and set `pendingRamp: "create"` on the rule. For `experiment-ref` and `safe-rollout` rules, only `schedule` is supported and is stored as legacy schedule fields on the rule itself (`rampSchedule` is not available for these rule types).

func (*FeatureRevisions) Archive

Archive - Set archived state in a draft revision

func (*FeatureRevisions) Create

Create a draft revision Creates a new draft revision branched from the current live revision.

func (*FeatureRevisions) DeleteLogEntry

DeleteLogEntry - Delete an owned revision Comment entry Author of a `Comment` log entry can delete it. Verdict entries (Approved, Requested Changes, Review Requested) and other audit-trail events are immutable. To retract a verdict use `/undo-review`; to retract a review request use `/recall-review`.

func (*FeatureRevisions) DeleteRule

DeleteRule - Delete a rule from a draft revision Removes the rule from the revision. Any pending ramp actions for this rule are also cleared.

func (*FeatureRevisions) DeleteRuleRampSchedule

DeleteRuleRampSchedule - Remove ramp schedule from a rule Clears any pending ramp action for this rule. If a live ramp schedule exists, queues a detach that removes it on publish — the rule will show `pendingRamp: "detach"`. If only a pending create exists, it is removed and `pendingRamp` is cleared.

func (*FeatureRevisions) Diff

Diff a revision against another revision Returns a schema-keyed JSON diff between this revision and a baseline. The same shapes the in-app review surface produces under `Copy as → Minimal JSON` / `Full JSON`: `minimal` lists only what changed (with id-keyed arrays bucketed into added/removed/modified items and reorder detection), while `full` returns the complete before/after content of the revision. Lifecycle fields (version, status, comment, date, createdBy, publishedBy) are excluded from the diff body and echoed via `from` / `to` instead. Defaults to diffing against the revision's own `baseVersion`; pass `?base=live` to diff against the current live revision, or `?base=<version>` for an arbitrary historical one.

func (*FeatureRevisions) Discard

Discard a draft revision

func (*FeatureRevisions) Get

Get a single feature revision Returns the revision at the specified version for this feature. Revision `rules` is a flat array with per-rule environment scope.

func (*FeatureRevisions) Latest

Latest - Get the most recent active draft revision Returns the most recently updated active draft revision for the feature. Returns 404 if no matching draft exists. Filter by status, author, or use `mine=true` to scope to the calling user's own drafts.

func (*FeatureRevisions) ListForFeature

ListForFeature - List revisions for a feature Returns a paginated list of revisions for this feature, sorted newest-first. Revision `rules` is a flat array with per-rule scope.

func (*FeatureRevisions) ListRevisions

ListRevisions - List revisions across all features Returns a paginated list of feature revisions across all features in the organization. Use the `featureId` query parameter to filter to a single feature. Revision `rules` is a flat array with per-rule scope.

func (*FeatureRevisions) Log

Log - List the activity log for a revision Returns every log entry for the revision — content edits (rules, default value, rebases), review lifecycle events (review requested, approved, changes requested, recalled, undone), comments, and other audit events — sorted oldest-first.

func (*FeatureRevisions) MergeStatus

MergeStatus - Get merge status for a draft revision Runs the three-way merge between the draft and the current live version without applying it. Conflicts are granular: each conflicting field gets its own key, and rules conflict individually (`rules.<ruleId>`, plus `rules.order` for competing reorders). Pass the returned `liveVersion` as `expectedLiveVersion` when rebasing. Also reports `rebaseRequired` so callers can detect ahead of time whether the publish endpoint will block until the draft is rebased.

func (*FeatureRevisions) Publish

Publish a draft revision Immediately publishes a draft revision, making it the live version of the feature. Any pending ramp actions (`pendingRamp` on rules) are executed atomically — ramp schedules are created or detached as queued.

func (*FeatureRevisions) Rebase

Rebase a draft revision onto the current live version Updates the draft's base revision to match the currently-live revision, applying the draft's changes on top. Supply `conflictResolutions` to resolve conflicting items individually — including per-rule (`rules.<ruleId>`) and rule-order (`rules.order`) conflicts. Supply `expectedLiveVersion` and/or `expectedDraftDateUpdated` (both returned by merge-status and rebase preview) to fail fast with `409` if either side changes between conflict review and submission. Unresolved conflicts also respond with `409`.

func (*FeatureRevisions) RebasePreview

RebasePreview - Preview a rebase without applying it Dry-run of the rebase: runs the same three-way merge with the supplied `conflictResolutions` and returns every conflict (resolved and unresolved) plus the merged result once all are resolved — without modifying the draft. Use it to iterate on resolutions before committing them via the rebase endpoint.

func (*FeatureRevisions) RecallReview

RecallReview - Recall a review request (revert to draft) Retracts the review request, returning the revision from `pending-review`, `changes-requested`, or `approved` back to `draft`. Allowed for any user with draft-management permission on the feature (the same permission required to request review), not only the original requester. Existing review log entries are preserved as audit history but any in-flight reviewer verdicts (Approved / Requested Changes) submitted during this review cycle no longer count — submitting a fresh `request-review` starts a new cycle.

func (*FeatureRevisions) Reopen

Reopen a discarded revision as a draft Returns a `discarded` revision to `draft` status so it can be edited, reviewed, and published. Prior review state is not restored — the draft must go back through review if approvals are required.

func (*FeatureRevisions) ReorderRules

ReorderRules - Reorder rules in the revision Replaces the flat global rule order. `ruleIds` must contain **exactly** the set of all existing rule IDs in the revision — no additions, omissions, or duplicates.

func (*FeatureRevisions) RequestReview

RequestReview - Request review for a draft revision Moves the draft into the `pending-review` state and notifies reviewers.

Set `autoPublishOnApproval` to `true` to publish the revision automatically the moment it is approved (GitHub auto-merge model). This requires the org to have auto-publish-on-approval enabled for the feature and the caller to have publish permission; the auto-publish then executes with the caller's authority.

Set `scheduledPublishAt` to a future ISO date-time to defer the auto-publish until that date (it still also requires approval when review is required). Use `scheduledPublishLockEdits` to freeze edits to this draft while the schedule is pending, and `scheduledPublishLockOthers` to block publishing other drafts of this feature in the meantime.

func (*FeatureRevisions) Revert

Revert the feature to a prior revision

func (*FeatureRevisions) SchedulePublish

SchedulePublish - Schedule (or cancel) a deferred publish for a draft revision Arms a deferred publish: the revision publishes automatically on/after `scheduledPublishAt` (and, when review is required, only once also approved). Send `scheduledPublishAt: null` to cancel the schedule.

Use `lockEdits` to freeze content edits to this draft while the schedule is pending (rebasing is still allowed), and `lockOthers` to block publishing other drafts of this feature until the schedule fires or is canceled. Requires publish permission; the publish executes with the caller's authority. An admin with bypass-approval permission can schedule even without approval — pass `bypassApproval: true` to mark it as an admin override, which locks the schedule to cancel-and-re-arm only.

func (*FeatureRevisions) SetDefaultValue

SetDefaultValue - Set the default value in a draft revision

func (*FeatureRevisions) SetHoldout

SetHoldout - Set holdout in a draft revision

func (*FeatureRevisions) SetMetadata

SetMetadata - Update revision metadata

func (*FeatureRevisions) SetPrerequisites

SetPrerequisites - Set feature-level prerequisites in a draft revision Sets the feature-level prerequisites for this revision. Each prerequisite must be a boolean feature flag; the gate is always 'prerequisite flag is on'. The condition is applied automatically — only the flag ID is required.

func (*FeatureRevisions) SetRuleRampSchedule

SetRuleRampSchedule - Set ramp schedule for a rule Queues a revision-controlled ramp action for this rule. If the rule already has a live ramp schedule, this stores an `update` action applied on publish; otherwise it stores a `create` action. No live schedule config changes are applied immediately by this endpoint.

You can build the ramp from a template (`templateId`) and set the rollback anchor (`startState`) in the same request — e.g. pull in a template and pass `startState: { "coverage": 0 }` so a rollback returns the rule to 0%.

func (*FeatureRevisions) SubmitReview

SubmitReview - Submit a review on a draft revision Submits an `approve`, `request-changes`, or `comment` review on the draft. Contributors cannot approve their own drafts when `blockSelfApproval` is enabled.

When `action` is `approve` and the revision has `autoPublishOnApproval` enabled, the revision is automatically published after approval. The response includes `autoPublished: true` when this happens. Pass `skipAutoPublish: true` to approve without triggering auto-publish.

func (*FeatureRevisions) Toggle

Toggle an environment on/off in a draft revision

func (*FeatureRevisions) UndoReview

UndoReview - Undo a reviewer's own review verdict Reviewer retracts their own verdict. The revision status rewinds to the state implied by the remaining active verdicts from other reviewers: any outstanding `Requested Changes` → `changes-requested`, else any outstanding `Approved` → `approved`, else `pending-review`. Existing review comments are preserved. If the retraction resolves the revision to `approved` and auto-publish-on-approval is armed, the revision is published.

func (*FeatureRevisions) UpdateRule

UpdateRule - Update a rule in a draft revision Patches fields on an existing rule (identified by `ruleId`). The rule `type` cannot be changed. Scope can be updated via `allEnvironments` / `environments` patch fields.

**Scheduling:** For `force` and `rollout` rules, update the schedule via `rampSchedule` (multi-step ramp) or `schedule` (simple start/end window) — these manage standalone ramp actions and set `pendingRamp: "create"` on the rule. For `experiment-ref` and `safe-rollout` rules, only `schedule` is supported and updates legacy schedule fields on the rule itself (`rampSchedule` is not available for these rule types).

type FeatureRevisionsV1

type FeatureRevisionsV1 struct {
	// contains filtered or unexported fields
}

FeatureRevisionsV1 - Draft revisions for feature flags, including rules, scheduling, and approval workflows.

**These are v1 endpoints.** New integrations should use the v2 Feature Revisions endpoints.

func (*FeatureRevisionsV1) Create deprecated

Create a draft revision **Deprecated.** Use [POST /v2/features/:id/revisions](#operation/postFeatureRevisionV2) instead.

Creates a new draft revision branched from the current live revision. A feature can have multiple concurrent drafts; use this to start an isolated line of edits.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeatureRevisionsV1) DeleteFeatureRevisionRule deprecated

DeleteFeatureRevisionRule - Delete a rule from a draft revision **Deprecated.** Use [DELETE /v2/features/:id/revisions/:version/rules/:ruleId](#operation/deleteFeatureRevisionRuleV2) instead, which removes the rule from the flat array without an `environment` parameter.

Removes the rule from the specified environment. Any pending ramp actions on the draft for this rule are also cleared.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeatureRevisionsV1) DeleteFeatureRevisionRuleRampSchedule deprecated

DeleteFeatureRevisionRuleRampSchedule - Remove ramp schedule from a rule **Deprecated.** Use [DELETE /v2/features/:id/revisions/:version/rules/:ruleId/ramp-schedule](#operation/deleteFeatureRevisionRuleRampScheduleV2) instead.

Removes a pending ramp schedule attached by the draft. If the rule currently has a live ramp schedule, a detach action is queued and applied at publish time.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeatureRevisionsV1) GetFeatureRevision deprecated

GetFeatureRevision - Get a single feature revision **Deprecated.** Use [GET /v2/features/:id/revisions/:version](#operation/getFeatureRevisionV2) instead.

Returns the revision at the specified version for this feature. Use `GET /features/{id}/revisions/latest` for the most recent active draft.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeatureRevisionsV1) GetFeatureRevisionLatest deprecated

GetFeatureRevisionLatest - Get the most recent active draft revision **Deprecated.** Use [GET /v2/features/:id/revisions/latest](#operation/getFeatureRevisionLatestV2) instead.

Returns the most recently updated draft revision for the feature. Returns 404 if there is no active draft. Pass `mine=true` to return the most recent draft authored by or contributed to by the calling user (requires a user-scoped API key).

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeatureRevisionsV1) GetFeatureRevisionMergeStatus deprecated

GetFeatureRevisionMergeStatus - Get merge status for a draft revision **Deprecated.** Use [GET /v2/features/:id/revisions/:version/merge-status](#operation/getFeatureRevisionMergeStatusV2) instead.

Runs a dry-run merge of the draft against the current live revision and returns any conflicts. Use this before publishing to preview changes and detect conflicting edits.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeatureRevisionsV1) ListForFeature deprecated

ListForFeature - List revisions for a feature **Deprecated.** Use [GET /v2/features/:id/revisions](#operation/getFeatureRevisionsV2) instead.

Returns a paginated list of revisions for this feature, sorted newest-first. Optionally filtered by status and/or author.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeatureRevisionsV1) ListRevisions deprecated

ListRevisions - List feature revisions **Deprecated.** Use [GET /v2/feature-revisions](#operation/listRevisionsV2) instead.

Returns a paginated list of feature revisions across all features in the organization. Optionally filtered by feature, status, author, and/or the calling user's involvement. Results are sorted newest-first.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeatureRevisionsV1) PostFeatureRevisionDiscard deprecated

PostFeatureRevisionDiscard - Discard a draft revision **Deprecated.** Use [POST /v2/features/:id/revisions/:version/discard](#operation/postFeatureRevisionDiscardV2) instead.

Permanently discards a draft revision. Only drafts (never published revisions) can be discarded. Any pending ramp actions staged on the draft are dropped.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeatureRevisionsV1) PostFeatureRevisionPublish deprecated

PostFeatureRevisionPublish - Publish a draft revision **Deprecated.** Use [POST /v2/features/:id/revisions/:version/publish](#operation/postFeatureRevisionPublishV2) instead.

Immediately publishes a draft revision, making it the live version of the feature. Blocked if the org requires approvals and `bypassApprovalChecks` is off.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeatureRevisionsV1) PostFeatureRevisionRebase deprecated

PostFeatureRevisionRebase - Rebase a draft revision onto the current live version **Deprecated.** Use [POST /v2/features/:id/revisions/:version/rebase](#operation/postFeatureRevisionRebaseV2) instead.

Updates the draft's base revision to match the currently-live revision, applying the draft's changes on top. Supply `conflictResolutions` to resolve any conflicting fields.

**Conflict key format changed for v1 clients.** The per-rule `envName.ruleId` keys used by older clients are no longer recognized. Valid keys: `defaultValue`, `prerequisites`, `archived`, `holdout`, `environmentsEnabled.<env>`, `metadata.<field>`, `rules.<ruleId>`, `rules.order`, and the blanket `rules` (applies one strategy to all rule-level conflicts). Unrecognized keys are ignored; unresolved conflicts respond with `409`.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeatureRevisionsV1) PostFeatureRevisionRequestReview deprecated

PostFeatureRevisionRequestReview - Request review for a draft revision **Deprecated.** Use [POST /v2/features/:id/revisions/:version/request-review](#operation/postFeatureRevisionRequestReviewV2) instead.

Moves the draft into the `pending-review` state and notifies reviewers.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeatureRevisionsV1) PostFeatureRevisionRevert deprecated

PostFeatureRevisionRevert - Revert the feature to a prior revision **Deprecated.** Use [POST /v2/features/:id/revisions/:version/revert](#operation/postFeatureRevisionRevertV2) instead.

Creates a new draft (or immediately publishes) whose content matches the specified historical revision.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeatureRevisionsV1) PostFeatureRevisionRuleAdd deprecated

PostFeatureRevisionRuleAdd - Add a rule to a draft revision **Deprecated.** Use [POST /v2/features/:id/revisions/:version/rules](#operation/postFeatureRevisionRuleAddV2) instead, which accepts rules with unified `allEnvironments`/`environments` scope fields instead of a per-environment `environment` parameter.

Appends a new rule to the end of the rule list for the given environment. A `rule.type` of `force`, `rollout`, `experiment-ref`, or `safe-rollout` determines the accepted shape. Use `rampSchedule` for ramp configuration or `schedule` for a simple start/end window; if both are provided, `rampSchedule` wins.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeatureRevisionsV1) PostFeatureRevisionRulesReorder deprecated

PostFeatureRevisionRulesReorder - Reorder rules in an environment **Deprecated.** Use [POST /v2/features/:id/revisions/:version/rules/reorder](#operation/postFeatureRevisionRulesReorderV2) instead, which reorders the global flat rule array without an `environment` parameter.

Replaces the rule order for the environment. `ruleIds` must contain **exactly** the set of existing rule IDs in that environment — no additions, omissions, or duplicates.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeatureRevisionsV1) PostFeatureRevisionSubmitReview deprecated

PostFeatureRevisionSubmitReview - Submit a review on a draft revision **Deprecated.** Use [POST /v2/features/:id/revisions/:version/submit-review](#operation/postFeatureRevisionSubmitReviewV2) instead.

Submits an `approve`, `request-changes`, or `comment` review on the draft. Contributors cannot approve their own drafts, but may submit comments or request changes.

When `action` is `approve` and the revision has `autoPublishOnApproval` enabled, the revision is automatically published after approval. Pass `skipAutoPublish: true` to approve without triggering auto-publish.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeatureRevisionsV1) PostFeatureRevisionToggle deprecated

PostFeatureRevisionToggle - Toggle an environment on/off in a draft revision **Deprecated.** Use [POST /v2/features/:id/revisions/:version/toggle](#operation/postFeatureRevisionToggleV2) instead.

Sets whether the feature is enabled in the given environment as part of the draft. Takes effect on publish.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeatureRevisionsV1) PutFeatureRevisionArchive deprecated

PutFeatureRevisionArchive - Set archived state in a draft revision **Deprecated.** Use [PUT /v2/features/:id/revisions/:version/archive](#operation/putFeatureRevisionArchiveV2) instead.

Sets whether the feature is archived. Archived features are excluded from SDK payloads on publish.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeatureRevisionsV1) PutFeatureRevisionDefaultValue deprecated

PutFeatureRevisionDefaultValue - Set the default value in a draft revision **Deprecated.** Use [PUT /v2/features/:id/revisions/:version/default-value](#operation/putFeatureRevisionDefaultValueV2) instead.

Replaces the feature's default value for this revision. The value must be a string representation matching the feature's value type (e.g. `"true"` for booleans, `42` for numbers, a JSON string for JSON features).

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeatureRevisionsV1) PutFeatureRevisionHoldout deprecated

PutFeatureRevisionHoldout - Set holdout in a draft revision **Deprecated.** Use [PUT /v2/features/:id/revisions/:version/holdout](#operation/putFeatureRevisionHoldoutV2) instead.

Sets (or clears, via `holdout: null`) the holdout experiment bound to the feature. Holdout linkage side-effects (updating the holdout's linked feature list) are applied on publish.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeatureRevisionsV1) PutFeatureRevisionMetadata deprecated

PutFeatureRevisionMetadata - Update revision metadata (comment, title, feature metadata) **Deprecated.** Use [PUT /v2/features/:id/revisions/:version/metadata](#operation/putFeatureRevisionMetadataV2) instead.

Updates draft-level metadata (`comment`, `title`) and/or feature-level metadata (owner, project, tags, customFields, jsonSchema, etc.). Merge semantics: omitted fields are left unchanged; any provided field replaces the current value (pass an empty string/array/object to clear). Feature metadata changes are staged on the revision and applied to the feature on publish. Changing `project` requires publish permission on both the old and new project.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeatureRevisionsV1) PutFeatureRevisionPrerequisites deprecated

PutFeatureRevisionPrerequisites - Set feature-level prerequisites in a draft revision **Deprecated.** Use [PUT /v2/features/:id/revisions/:version/prerequisites](#operation/putFeatureRevisionPrerequisitesV2) instead.

Replaces the feature's prerequisite list for this revision. Each prerequisite condition is evaluated against `{ value: <prereq-flag-value> }` at SDK eval time — use `value` as the condition key.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeatureRevisionsV1) PutFeatureRevisionRule deprecated

PutFeatureRevisionRule - Update a rule in a draft revision **Deprecated.** Use [PUT /v2/features/:id/revisions/:version/rules/:ruleId](#operation/putFeatureRevisionRuleV2) instead, which locates rules by `ruleId` in the flat array without an `environment` parameter.

Patches fields on an existing rule. The rule `type` cannot be changed — to convert types, delete and re-add. Fields that don't apply to the current rule type are rejected.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeatureRevisionsV1) PutFeatureRevisionRuleRampSchedule deprecated

PutFeatureRevisionRuleRampSchedule - Set ramp schedule for a rule **Deprecated.** Use [PUT /v2/features/:id/revisions/:version/rules/:ruleId/ramp-schedule](#operation/putFeatureRevisionRuleRampScheduleV2) instead.

Queues a revision-controlled ramp action for this rule. If the rule already has a live ramp schedule, this stores an `update` action applied on publish; otherwise it stores a `create` action. No live schedule config changes are applied immediately by this endpoint.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

type Features

type Features struct {
	// contains filtered or unexported fields
}

Features - Control your feature flags programatically.

Rules are returned as a unified top-level array; each rule carries `allEnvironments` / `environments` scope fields instead of being bucketed by environment.

func (*Features) Create

Create a single feature Creates a new feature. Rules are supplied as a top-level `rules` array; each rule includes `allEnvironments` / `environments` scope fields.

### Config-backed features (Config mode)

A JSON feature can be backed by a shared **config** — the config supplies the base JSON value and schema, and the feature's *rule* values become override *patches* merged on top (nested objects deep-merge; arrays and scalars replace). The default value is exactly a config with no overrides (see below). Config backing is set exclusively through dedicated fields — never a raw `$extends: ["@config:…"]` inside a value string (that is rejected). `@const:` references inside values still work.

- **Top-level (`baseConfig`):** set `valueType: "json"` and `baseConfig: "<configKey>"` to put the flag in Config mode. The config must be live. This is the family root and the base the default value patches. - **Default value:** unlike rules, the default is exactly a config with no overrides of its own — send `defaultValue: "{}"` to use `baseConfig`. To resolve the default to a *descendant* of `baseConfig` instead, set `defaultValueConfig` to that descendant's key (it must be within `baseConfig`'s family); omit/null to use `baseConfig` directly. - **Rules & experiment variations:** each carries its own `config` field naming the family config that value patches (omit/null to patch the base). `value` is the override patch.

Example:

```json {

  "id": "checkout-config",
  "valueType": "json",
  "baseConfig": "purchase-flow",
  "defaultValue": "{}",
  "rules": [
    { "type": "force", "config": "purchase-flow-vip", "value": "{\"maxItems\": 20}", "allEnvironments": true }
  ]
}

```

func (*Features) Delete

Delete - Deletes a single feature Permanently deletes a feature and all of its revisions.

Archived features can be deleted freely. Deleting a live (non-archived) feature returns 403 unless the org setting "REST API always bypasses approval requirements" is enabled.

func (*Features) Get

Get a single feature

func (*Features) GetFeatureKeys

GetFeatureKeys - Get list of feature keys

func (*Features) GetFeatureStale

GetFeatureStale - Get stale status for one or more features

func (*Features) List

List - Get all features Returns features with pagination. Rules are returned as a unified top-level array with per-rule environment scope.

func (*Features) Revert

Revert a feature to a specific revision Creates a new revision whose rules and values match a previously-published revision, then immediately publishes it, leaving a clear audit trail of the revert in the revision history.

Returns 403 if the API key lacks permission, or if approval rules are enabled for an affected environment and neither the "REST API always bypasses approval requirements" nor the "Allow reverts without approval" org setting is enabled.

Returns 422 with a list of `warnings` if the restored values no longer validate against the feature's current value type or JSON schema (e.g. reverting to a config the current schema can no longer read). Re-submit with `?ignoreWarnings=true` to revert anyway.

func (*Features) Toggle

Toggle a feature in one or more environments Enables or disables a feature in one or more environments simultaneously. Accepts a map of environment name → boolean.

func (*Features) Update

Update - Partially update a feature Updates any combination of a feature's metadata, default value, environment state, and rules. Other top-level fields are patch-merged: omit a field to leave it unchanged. The `rules` field, when supplied, replaces the entire `rules` array atomically in a single revision (v1 PUT applied per-environment patches; v2 swaps the full flat array). To preserve existing rules during a partial edit, GET the feature first, mutate the returned `rules` array, and PUT the full array back. Safe-rollout rules round-trip via their `safeRolloutId`; use `POST /v2/features/:id/revisions/:version/rules` to create new ones. Returns 403 if approval rules are enabled for an affected environment and the bypass setting is off.

type FeaturesV1

type FeaturesV1 struct {
	// contains filtered or unexported fields
}

FeaturesV1 - Control your feature flags programatically.

**These are v1 endpoints.** New integrations should use the v2 Feature Flags endpoints, which expose a unified per-rule environment scope instead of per-environment rule arrays.

func (*FeaturesV1) Create deprecated

Create a single feature **Deprecated.** Use [POST /v2/features](#operation/postFeatureV2) instead.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeaturesV1) Delete deprecated

Delete - Deletes a single feature **Deprecated.** Use [DELETE /v2/features/:id](#operation/deleteFeatureV2) instead.

Permanently deletes a feature and all of its revisions.

Archived features can be deleted freely. Deleting a live (non-archived) feature returns 403 unless the org setting "REST API always bypasses approval requirements" is enabled, or the API key lacks delete permission.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeaturesV1) Get deprecated

Get a single feature **Deprecated.** Use [GET /v2/features/:id](#operation/getFeatureV2) instead.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeaturesV1) GetFeatureKeys deprecated

GetFeatureKeys - Get list of feature keys **Deprecated.** Use [GET /v2/feature-keys](#operation/getFeatureKeysV2) instead.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeaturesV1) GetFeatureStale deprecated

GetFeatureStale - Get stale status for one or more features **Deprecated.** Use [GET /v2/stale-features](#operation/getFeatureStaleV2) instead.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeaturesV1) List deprecated

List - Get all features **Deprecated.** Use [GET /v2/features](#operation/listFeaturesV2) instead.

Returns features with pagination. The skipPagination query parameter is honored only when API_ALLOW_SKIP_PAGINATION is set (self-hosted deployments).

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeaturesV1) Revert deprecated

Revert a feature to a specific revision **Deprecated.** Use [POST /v2/features/:id/revert](#operation/revertFeatureV2) instead.

Creates a new revision whose rules and values match a previously-published revision, then immediately publishes it. This leaves a clear audit trail of the revert action in the revision history.

Returns 403 if the API key lacks permission, or if approval rules are enabled for an affected environment and neither the "REST API always bypasses approval requirements" nor the "Allow reverts without approval" org setting is enabled.

Returns 422 with a list of `warnings` if the restored values no longer validate against the feature's current value type or JSON schema. Re-submit with `?ignoreWarnings=true` to revert anyway.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeaturesV1) Toggle deprecated

Toggle a feature in one or more environments **Deprecated.** Use [POST /v2/features/:id/toggle](#operation/toggleFeatureV2) instead.

Enables or disables a feature in one or more environments simultaneously. Accepts a map of environment name → boolean and immediately publishes the change.

Returns 403 if the API key lacks permission or if approval rules are enabled for an affected environment and the org setting "REST API always bypasses approval requirements" is off.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

func (*FeaturesV1) Update deprecated

Update - Partially update a feature **Deprecated.** Use [POST /v2/features/:id](#operation/updateFeatureV2) instead.

Updates any combination of a feature's metadata (description, owner, tags, project), default value, environment settings (rules, kill switches, enabled state), prerequisites, holdout assignment, or JSON schema validation. All provided fields are merged into the existing feature and the result is immediately published as a new revision.

Returns 403 if the API key lacks permission or if approval rules are enabled for an affected environment and the org setting "REST API always bypasses approval requirements" is off.

Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.

type Growthbook

type Growthbook struct {
	SDKVersion string
	// Control your feature flags programatically.
	//
	// **These are v1 endpoints.** New integrations should use the v2 Feature Flags endpoints, which expose a unified per-rule environment scope instead of per-environment rule arrays.
	FeaturesV1 *FeaturesV1
	// Draft revisions for feature flags, including rules, scheduling, and approval workflows.
	//
	// **These are v1 endpoints.** New integrations should use the v2 Feature Revisions endpoints.
	FeatureRevisionsV1 *FeatureRevisionsV1
	// Control your feature flags programatically.
	//
	// Rules are returned as a unified top-level array; each rule carries `allEnvironments` / `environments` scope fields instead of being bucketed by environment.
	Features *Features
	// Draft revisions for feature flags, including rules, scheduling, and approval workflows.
	//
	// Revision `rules` is a flat array with per-rule scope fields.
	FeatureRevisions *FeatureRevisions
	// Archetypes allow you to simulate the result of targeting rules on pre-set user attributes
	Archetypes *Archetypes
	// Experiments (A/B Tests)
	Experiments *Experiments
	// Experiment Snapshots (the individual updates of an experiment)
	Snapshots *Snapshots
	// Groups of visual changes made by the visual editor to a single page
	VisualChangesets  *VisualChangesets
	ContextualBandits *ContextualBandits
	// Metrics used as goals and guardrails for experiments
	Metrics      *Metrics
	UsageMetrics *UsageMetrics
	// Segments used during experiment analysis
	Segments *Segments
	// Dimensions used during experiment analysis
	Dimensions *Dimensions
	// Projects are used to organize your feature flags and experiments
	Projects *Projects
	// GrowthBook comes with one environment by default (production), but you can add as many as you need. When used with feature flags, you can enable/disable feature flags on a per-environment basis.
	Environments *Environments
	// Used when targeting feature flags and experiments.
	Attributes *Attributes
	// Client keys and settings for connecting SDKs to a GrowthBook instance
	SDKConnections *SDKConnections
	// How GrowthBook connects and queries your data, including cached database schema metadata (information schemas) for tables and columns.
	DataSources *DataSources
	// Defined sets of attribute values which can be used with feature rules for targeting features at particular users.
	SavedGroups *SavedGroups
	// Draft revisions for saved groups, including pending changes, approvals, and lifecycle (publish, discard, revert).
	//
	// Most callers can interact with these endpoints via shorthand actions (`/items/add`, `/items/remove`, single-field PUTs) instead of authoring JSON Patch ops directly. Pass `version: "new"` on edit endpoints to auto-create a draft.
	SavedGroupRevisions *SavedGroupRevisions
	// Reusable named values referenced from feature flag values as `@const:key` and resolved into the SDK payload at build time. String constants are interpolated via `{{ @const:key }}`; JSON (object) constants are composed via an `$extends` array.
	Constants *Constants
	// Draft revisions for constants, including pending changes, approvals, and lifecycle (publish, discard, revert). Pass `version: "new"` on edit endpoints to auto-create a draft.
	ConstantRevisions *ConstantRevisions
	// Reusable, typed, inheritable JSON objects referenced from feature flag values as `@config:key`. A config carries a field `schema` (with TypeScript/JSON Schema import-export) and a lineage `parent`; it resolves like a `json` constant, composed via `$extends`. Inheritance is expressed via `parent`, never an in-value `@config:` entry. Schema fields colliding with a published ancestor's key follow 'base wins': identical re-declarations are stripped with a warning, differing ones are rejected.
	Configs *Configs
	// Draft revisions for configs, including value and schema edits, schema import (JSON Schema / TypeScript / inferred), approvals, and lifecycle (publish, discard, revert). Publishing a schema change cascades the "base wins" normalization to descendant configs; a publish that removes or retypes fields descendants still use soft-blocks with a 422 unless `?ignoreWarnings=true`. Pass `version: "new"` on edit endpoints to auto-create a draft.
	ConfigRevisions *ConfigRevisions
	// Sandboxed JavaScript validation hooks that run when features, configs, or their revisions are saved or published. Throwing an Error blocks the save; `addWarning(msg)` raises a soft warning. Hooks are scoped by projects, or pinned to a single feature/config via `entityType`/`entityId`; a config-scoped hook also runs for every config inheriting from it (its whole descendant lineage). Scope can be retargeted on update (or cleared with nulls). Requires an enterprise plan; not available on GrowthBook Cloud.
	CustomHooks *CustomHooks
	// Organizations are used for multi-org deployments where different teams can run their own isolated feature flags and experiments. These endpoints are only via a super-admin's Personal Access Token.
	Organizations *Organizations
	// Fact Tables describe the shape of your data warehouse tables
	FactTables *FactTables
	// Fact Metrics are metrics built on top of Fact Table definitions
	FactMetrics *FactMetrics
	// Intended for use with our code reference CI utility, [`gb-find-code-refs`](https://github.com/growthbook/gb-find-code-refs).
	CodeReferences *CodeReferences
	// Members are users who have been invited to an organization.
	Members *Members
	// Retrieve queries used in experiments to calculate results.
	Queries *Queries
	// Get the organization settings.
	Settings *Settings
	// Server metadata, including the running build's version and commit for version-skew checks.
	Meta *Meta
	// Multi-step rollout schedules that gradually increase feature rule traffic over time, with optional real-time monitoring. Each step supports interval timers, approval gates, and hold conditions. Monitored steps are backed by a live analysis experiment that can automatically hold, roll back, or advance the ramp based on guardrail and signal metric health.
	RampSchedules *RampSchedules
	// Custom analysis reports built on top of experiment snapshots. Reports let you re-run analysis with different metrics, date ranges, stats engines, and other settings without modifying the underlying experiment.
	Reports *Reports
	// Namespaces partition your user population into buckets so that experiments using the same hash attribute do not overlap unintentionally. Each namespace defines a 0–1 range and individual experiments claim sub-ranges within it.
	Namespaces              *Namespaces
	Dashboards              *Dashboards
	ContextualBanditQueries *ContextualBanditQueries
	CustomFields            *CustomFields
	MetricGroups            *MetricGroups
	Teams                   *Teams
	ExperimentTemplates     *ExperimentTemplates
	AnalyticsExplorations   *AnalyticsExplorations
	// Reusable step configurations for ramp schedules.
	RampScheduleTemplates *RampScheduleTemplates
	// contains filtered or unexported fields
}

Growthbook - GrowthBook REST API: A command-line interface for GrowthBook — manage feature flags, experiments, metrics, and more from your terminal.

Endpoints are versioned by path prefix: `/v1` (stable) and `/v2` (improved shapes). Each command group targets the newest version of its endpoint; superseded versions remain available under a `-vN` suffix.

Authenticate with a Secret Key or Personal Access Token via `--bearer-auth` (or the `GBCLI_BEARER_AUTH` environment variable). Run `growthbook configure` to store credentials, or `growthbook whoami` to check the active configuration.

func New

func New(opts ...SDKOption) *Growthbook

New creates a new instance of the SDK with the provided options

func (*Growthbook) GetSDKPayload

GetSDKPayload - Get a SDK payload

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient provides an interface for supplying the SDK with a custom HTTP client

type Members

type Members struct {
	// contains filtered or unexported fields
}

Members are users who have been invited to an organization.

func (*Members) DeleteMember

DeleteMember - Removes a single user from an organization

func (*Members) ListMembers

ListMembers - Get all organization members

func (*Members) UpdateMemberRole

UpdateMemberRole - Update a member's global role (including any enviroment restrictions, if applicable). Can also update a member's project roles if your plan supports it.

type Meta

type Meta struct {
	// contains filtered or unexported fields
}

Meta - Server metadata, including the running build's version and commit for version-skew checks.

func (*Meta) GetVersion

func (s *Meta) GetVersion(ctx context.Context, opts ...operations.Option) (*operations.GetVersionResponse, error)

GetVersion - Get the GrowthBook server version and build info

type MetricGroups

type MetricGroups struct {
	// contains filtered or unexported fields
}

func (*MetricGroups) CreateMetricGroup

CreateMetricGroup - Create a single metricGroup

func (*MetricGroups) DeleteMetricGroup

DeleteMetricGroup - Delete a single metricGroup

func (*MetricGroups) GetMetricGroup

GetMetricGroup - Get a single metricGroup

func (*MetricGroups) ListMetricGroups

func (s *MetricGroups) ListMetricGroups(ctx context.Context, opts ...operations.Option) (*operations.ListMetricGroupsResponse, error)

ListMetricGroups - Get all metricGroups

func (*MetricGroups) UpdateMetricGroup

UpdateMetricGroup - Update a single metricGroup

type Metrics

type Metrics struct {
	// contains filtered or unexported fields
}

Metrics used as goals and guardrails for experiments

func (*Metrics) Create

Create a single metric

func (*Metrics) DeleteMetric

DeleteMetric - Deletes a metric

func (*Metrics) GetMetric

GetMetric - Get a single metric

func (*Metrics) ListMetrics

ListMetrics - Get all metrics

func (*Metrics) Update

Update a metric

type Namespaces

type Namespaces struct {
	// contains filtered or unexported fields
}

Namespaces partition your user population into buckets so that experiments using the same hash attribute do not overlap unintentionally. Each namespace defines a 0–1 range and individual experiments claim sub-ranges within it.

func (*Namespaces) Create

Create a namespace

func (*Namespaces) DeleteNamespace

DeleteNamespace - Delete a namespace Permanently removes a namespace from the organization. Returns a 409 error if any active experiments currently reference this namespace — disable or remove those references first.

func (*Namespaces) GetMemberships

GetMemberships - Get namespace membership

func (*Namespaces) GetNamespace

GetNamespace - Get a single namespace

func (*Namespaces) ListNamespaces

ListNamespaces - Get all namespaces

func (*Namespaces) RotateSeed

RotateSeed - Rotate namespace seed ⚠️ Dangerous: sets a new seed for a multiRange namespace. Every user's bucket position within the namespace is re-computed immediately, which re-randomizes traffic eligibility for **all** experiments currently using this namespace. Only do this if you intentionally want to reshuffle all allocations across experiments. This could be useful when re-using a namespace for a new set of experiments.

func (*Namespaces) Update

Update a namespace

type Organizations

type Organizations struct {
	// contains filtered or unexported fields
}

Organizations are used for multi-org deployments where different teams can run their own isolated feature flags and experiments. These endpoints are only via a super-admin's Personal Access Token.

func (*Organizations) Create

Create a single organization (only for super admins on multi-org Enterprise Plan only)

func (*Organizations) ListOrganizations

ListOrganizations - Get all organizations (only for super admins on multi-org Enterprise Plan only)

func (*Organizations) Update

Update - Edit a single organization (only for super admins on multi-org Enterprise Plan only)

type Projects

type Projects struct {
	// contains filtered or unexported fields
}

Projects are used to organize your feature flags and experiments

func (*Projects) Create

Create a single project

func (*Projects) DeleteProject

DeleteProject - Deletes a single project

func (*Projects) GetProject

GetProject - Get a single project

func (*Projects) ListProjects

ListProjects - Get all projects

func (*Projects) Update

Update - Edit a single project

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

Queries - Retrieve queries used in experiments to calculate results.

func (*Queries) GetQuery

GetQuery - Get a single query

type RampScheduleTemplates

type RampScheduleTemplates struct {
	// contains filtered or unexported fields
}

RampScheduleTemplates - Reusable step configurations for ramp schedules.

func (*RampScheduleTemplates) CreateRampScheduleTemplate

CreateRampScheduleTemplate - Create a single rampScheduleTemplate

func (*RampScheduleTemplates) DeleteRampScheduleTemplate

DeleteRampScheduleTemplate - Delete a single rampScheduleTemplate

func (*RampScheduleTemplates) GetRampScheduleTemplate

GetRampScheduleTemplate - Get a single rampScheduleTemplate

func (*RampScheduleTemplates) ListRampScheduleTemplates

ListRampScheduleTemplates - Get all rampScheduleTemplates

func (*RampScheduleTemplates) UpdateRampScheduleTemplate

UpdateRampScheduleTemplate - Update a single rampScheduleTemplate

type RampSchedules

type RampSchedules struct {
	// contains filtered or unexported fields
}

RampSchedules - Multi-step rollout schedules that gradually increase feature rule traffic over time, with optional real-time monitoring. Each step supports interval timers, approval gates, and hold conditions. Monitored steps are backed by a live analysis experiment that can automatically hold, roll back, or advance the ramp based on guardrail and signal metric health.

func (*RampSchedules) APIAdvanceRampSchedule

APIAdvanceRampSchedule - Advance to the next step, overriding any holds Moves the schedule to the next step, bypassing **all** hold conditions — interval, min sample size, and monitoring signal holds. Accepts `running` or `paused` status; if paused, the schedule is implicitly resumed (timing anchors recalculated) before the step moves.

**Approval gate**: if the current step has an unsatisfied `holdConditions.requiresApproval` gate, this endpoint returns **409** by default. Either call `/actions/approve-step` first (recommended), or pass `force: true` to override the approval gate. `force: true` requires `canBypassApprovalChecks` permission and is logged in the audit trail.

**Two common uses:** - **Post-interval monitoring hold** (`decision: "hold"`, interval elapsed): the

step timer has completed but a signal or guardrail is flagging concern. Use
this after reviewing the `/status` health summary and deciding to accept the
risk and proceed.

- **Hard override**: skip a step regardless of where it is in its interval or

hold conditions (CI gate, external deployment pipeline).

When to use other actions instead: - **`/actions/resume`** — restores a paused schedule without moving the step. - **`/actions/approve-step`** — clears only the approval gate; other conditions

still resolve naturally.

- **`/actions/rollback`** — preferred response when `decision: "rollback"` or

signals include `guardrail-failing`.

func (*RampSchedules) AddTargetRampSchedule

AddTargetRampSchedule - Add a target rule to a ramp schedule Attaches an additional feature rule to this ramp schedule. The `ruleId` must identify a rule that is already published and must not already be controlled by another schedule. `environment` is accepted for backward compatibility with pre-v2 ramps but is deprecated and no longer required.

func (*RampSchedules) ApproveStepRampSchedule

ApproveStepRampSchedule - Approve the pending approval gate Clears whichever approval gate is currently pending on the schedule:

- **Start gate** — a schedule created with `requiresStartApproval` sits in `ready` at step -1 with its rule disabled (zero traffic). Approving starts the ramp (or, if a future `startDate` is set, arms it to start on that date). - **Step gate** — the `holdConditions.requiresApproval` gate on the current step of a `running` schedule.

For a step gate, approval is the **final** gate: it can only be granted once every other hold has cleared. This endpoint rejects the request (`400`) if the step is not yet ready — while the interval timer is still counting down, or (for monitored steps) before fresh analysis is available or while a guardrail/health signal is failing. Poll `/status` and call this once it reports awaiting approval.

**Non-monitored steps**: once the interval has elapsed, approving clears the last hold and advances immediately, chaining through subsequent instant steps.

**Monitored steps**: approving clears the last hold and the agenda advances on its next tick (re-checking analysis first).

Different from `/actions/advance`: `approve-step` works within the normal evaluation flow and refuses to skip ahead of the interval or any other unmet gate. Use `/actions/advance` to bypass all remaining holds.

Requires update + publish (start gate) or review (step gate) permissions for the associated feature.

func (*RampSchedules) CompleteRampSchedule

CompleteRampSchedule - Complete a ramp schedule immediately Immediately applies the schedule's end-state rule patches (the equivalent of what would happen after the last step advances normally) and marks the schedule as `completed`, skipping any remaining steps.

Pass `disableRule: true` to also disable the linked rule (equivalent to the cutoff-date-driven completion).

func (*RampSchedules) Create

Create a ramp schedule

func (*RampSchedules) DeleteRampSchedule

DeleteRampSchedule - Delete a single rampSchedule Permanently deletes a ramp schedule. This does not undo any rule patches that were already applied by completed steps.

func (*RampSchedules) EjectTargetRampSchedule

EjectTargetRampSchedule - Remove a target rule from a ramp schedule Detaches a target rule from this ramp schedule. Identify the target either by its `targetId` or by the `[ruleId, environment]` pair.

If this is the last target on the schedule, the schedule is deleted entirely and the response contains `deleted: true` instead of `rampSchedule`.

func (*RampSchedules) GetRampSchedule

GetRampSchedule - Get a single rampSchedule

func (*RampSchedules) GetRampScheduleStatus

GetRampScheduleStatus - Get ramp schedule status summary Returns a real-time status summary for a ramp schedule: current step, overall health decision, traffic quality, and per-metric effect sizes. Designed for CI pipeline integrations and monitoring dashboards that need a single call to determine whether it is safe to advance.

func (*RampSchedules) JumpRampSchedule

JumpRampSchedule - Jump to a specific step Teleports the schedule to `targetStepIndex` (forward or backward) and leaves it `paused`. Resets timing anchors so the destination step's interval starts fresh when the schedule is next resumed or started.

Pass `-1` to return to the pre-start position without applying rollback rule patches — useful for resetting a non-started schedule. For a full traffic revert, use `/actions/rollback` instead.

Accepts any non-terminal schedule status.

func (*RampSchedules) ListRampSchedules

ListRampSchedules - Get all rampSchedules Returns all ramp schedules for the organization, with optional filters.

func (*RampSchedules) PauseRampSchedule

PauseRampSchedule - Pause a ramp schedule Pauses a `running` schedule. Traffic percentages are frozen at their current values; no step advancement happens while paused. Records `pausedAt` so that interval timing can be correctly offset when the schedule resumes.

Use `/actions/resume` to continue from the same step, or `/actions/rollback` to revert all rule effects entirely.

func (*RampSchedules) RefreshMonitoringRampSchedule

RefreshMonitoringRampSchedule - Trigger a manual monitoring update Queues a new analysis snapshot for the schedule's monitoring experiment. The snapshot runs asynchronously — poll `GET /ramp-schedules/:id/status` until `snapshotAt` advances to confirm results are ready.

Only available when the schedule is within its monitored step window: - Not in a terminal state (`completed` or `rolled-back`). - Has at least one step with `monitored: true`. - `currentStepIndex` is within `[firstMonitoredStepIndex, lastMonitoredStepIndex]`.

Violating any condition returns **409 Conflict** with a descriptive message.

Requires the `runQueries` permission on the configured datasource (enforced via `canRunExperimentQueries`).

func (*RampSchedules) RestartRampSchedule

RestartRampSchedule - Restart a terminal ramp schedule Brings a `rolled-back` (or `completed`) schedule back into `running` in a single call. Any prior start-on-date delays are cleared (`startedAt`, `phaseStartedAt`, etc. are reset), `currentStepIndex` is normalised to `-1`, then the same logic as `/actions/start` runs to apply start actions and advance through immediately-eligible steps.

The rollback that preceded this already rewound rule effects to the starting position; this endpoint does **not** re-execute that rewind for `rolled-back` schedules. `completed` schedules are defensively rewound first.

func (*RampSchedules) ResumeRampSchedule

ResumeRampSchedule - Resume a paused ramp schedule Resumes a `paused` schedule without moving the current step. Timing anchors (`phaseStartedAt`, `startedAt`) are shifted forward by the pause duration so that interval-based steps continue from where they left off rather than restarting their clock.

Does **not** advance to the next step — use `/actions/advance` if you also want to skip the remainder of the current step.

func (*RampSchedules) RollbackRampSchedule

RollbackRampSchedule - Roll back a ramp schedule Rewinds all ramp effects (rule coverage, targeting, etc.) to the starting position and lands in terminal `rolled-back` status. The reason is persisted as `lastRollbackReason` (prefixed with `Manual: `) and surfaced in the UI.

This is also the correct response to a monitoring alert — when the `/status` endpoint returns `decision: "rollback"` or signals include `guardrail-failing`, call this endpoint with a descriptive `reason`.

From this terminal state the schedule can be brought back to `ready` via `/actions/restart`, after which `/actions/start` will run it again.

func (*RampSchedules) SetAutoUpdateRampSchedule

SetAutoUpdateRampSchedule - Toggle automatic monitoring updates Deprecated alias for setting monitoring mode. Prefer `/actions/set-monitoring-mode`.

func (*RampSchedules) SetMonitoringModeRampSchedule

SetMonitoringModeRampSchedule - Set ramp monitoring mode Sets the user preference for ramp monitoring updates. In `manual` mode, automatic snapshot scheduling is disabled and operators must click Update manually. In `auto` mode, snapshots run automatically when the current step is monitored and the ramp is running.

func (*RampSchedules) StartRampSchedule

StartRampSchedule - Start a ramp schedule Transitions the schedule from `ready` to `running`. The schedule must have at least one target rule attached — a schedule created without targets starts in `pending` and moves to `ready` automatically when the first target is attached via `/actions/add-target`.

The first step is processed immediately: interval-free steps advance right away; interval-based steps arm a timer. Once started, use `/actions/pause` to halt, `/actions/advance` to skip steps, or `/actions/rollback` to revert.

func (*RampSchedules) UpdateRampSchedule

UpdateRampSchedule - Update a single rampSchedule Updates the name, steps, endActions, startDate, or cutoffDate of a ramp schedule.

Only allowed when the schedule is in `pending`, `ready`, or `paused` status.

**targetId shorthand**: When providing `steps` or `endActions`, you may omit `targetId` (or pass `"t1"`) in each action. If the schedule has exactly one active target, the server will resolve it automatically. For schedules with multiple targets, provide the explicit target UUID from `targets[].id`.

**Coverage on monitored steps**: See the create endpoint description for details on how `coverage` is interpreted for monitored steps (total enrollment, not variation-1 exposure).

func (*RampSchedules) UpdateRampScheduleLockdown

UpdateRampScheduleLockdown - Update ramp lockdown configuration Sets the lockdown mode. `locked` prevents other users from publishing unrelated changes to the parent feature while the ramp is running — useful when you want to ensure no external edits interfere with a live rollout. It does **not** affect the ramp's own auto-advancement or monitoring behavior; use `actions/pause` to halt the ramp itself. `none` removes the publishing restriction.

func (*RampSchedules) UpdateRampScheduleMonitoring

UpdateRampScheduleMonitoring - Update ramp monitoring configuration Replaces the monitoring configuration. Metric IDs, snapshot cadence, and health-action thresholds (`srmAction`, `noTrafficAction`, etc.) can be updated at any time.

`datasourceId` and `exposureQueryId` are locked once monitoring starts — stop and recreate the schedule to change the data source.

Changes to guardrail or signal metric IDs take effect on the next analysis run.

func (*RampSchedules) UpdateRampScheduleSteps

UpdateRampScheduleSteps - Update ramp schedule steps Fully replaces the steps array for a ramp schedule. Only allowed when the schedule is in a non-running, non-terminal state (`ready`, `pending`, or `paused`). Pause a running schedule first; restart a terminal schedule first.

**Step actions** (coverage/targeting patches) are not accepted here — they change the SDK payload and must go through a feature revision draft. Existing step actions are preserved for each position. Use `PUT /v2/features/:id/revisions/:version/rules/:ruleId/ramp-schedule` to modify coverage/targeting.

type Reports

type Reports struct {
	// contains filtered or unexported fields
}

Reports - Custom analysis reports built on top of experiment snapshots. Reports let you re-run analysis with different metrics, date ranges, stats engines, and other settings without modifying the underlying experiment.

func (*Reports) Create

Create a new report

func (*Reports) GetReport

GetReport - Get a single report

func (*Reports) ListReports

ListReports - Get all reports

func (*Reports) Refresh

Refresh a report by re-running its analysis

func (*Reports) SetMetadata

SetMetadata - Update report metadata (title, description, visibility)

func (*Reports) SetSettings

SetSettings - Update report analysis settings Updates the analysis settings for an existing report. Changes are staged and do not take effect until you call `POST /reports/:id/refresh`.

type SDKConnections

type SDKConnections struct {
	// contains filtered or unexported fields
}

SDKConnections - Client keys and settings for connecting SDKs to a GrowthBook instance

func (*SDKConnections) Create

Create a single sdk connection

func (*SDKConnections) DeleteSDKConnection

DeleteSDKConnection - Deletes a single SDK connection

func (*SDKConnections) GetSDKConnection

GetSDKConnection - Get a single sdk connection

func (*SDKConnections) ListSDKConnections

ListSDKConnections - Get all sdk connections

func (*SDKConnections) LookupSDKConnectionByKey

LookupSDKConnectionByKey - Find a single sdk connection by its key

func (*SDKConnections) Update

Update a single sdk connection

type SDKOption

type SDKOption func(*Growthbook)

func WithClient

func WithClient(client HTTPClient) SDKOption

WithClient allows the overriding of the default HTTP client used by the SDK

func WithDomain

func WithDomain(domain string) SDKOption

WithDomain allows setting the domain variable for url substitution

func WithRetryConfig

func WithRetryConfig(retryConfig retry.Config) SDKOption

func WithSecurity

func WithSecurity(security components.Security) SDKOption

WithSecurity configures the SDK to use the provided security details

func WithSecuritySource

func WithSecuritySource(security func(context.Context) (components.Security, error)) SDKOption

WithSecuritySource configures the SDK to invoke the Security Source function on each method call to determine authentication

func WithServerIndex

func WithServerIndex(serverIndex int) SDKOption

WithServerIndex allows the overriding of the default server by index

func WithServerURL

func WithServerURL(serverURL string) SDKOption

WithServerURL allows providing an alternative server URL

func WithTemplatedServerURL

func WithTemplatedServerURL(serverURL string, params map[string]string) SDKOption

WithTemplatedServerURL allows the overriding of the default server URL with a templated URL populated with the provided parameters

func WithTimeout

func WithTimeout(timeout time.Duration) SDKOption

WithTimeout Optional request timeout applied to each operation

type SavedGroupRevisions

type SavedGroupRevisions struct {
	// contains filtered or unexported fields
}

SavedGroupRevisions - Draft revisions for saved groups, including pending changes, approvals, and lifecycle (publish, discard, revert).

Most callers can interact with these endpoints via shorthand actions (`/items/add`, `/items/remove`, single-field PUTs) instead of authoring JSON Patch ops directly. Pass `version: "new"` on edit endpoints to auto-create a draft.

func (*SavedGroupRevisions) AddItems

AddItems - Append items to a list saved group draft revision Appends the provided items (deduplicated) to the draft's `values` array. Only valid for `list` saved groups. Pass `version: "new"` to auto-create a draft. Duplicate items are merged on top of any existing draft, so multiple successive add/remove calls accumulate.

func (*SavedGroupRevisions) Archive

Archive - Stage an archive/unarchive in a draft revision Stages an archive or unarchive on the draft. Pass `version: "new"` to auto-create a draft. Archived saved groups can be permanently deleted via `DELETE /saved-groups/{id}` once the archive is published.

func (*SavedGroupRevisions) Create

Create a draft revision Creates a new draft revision branched from the current live saved group. A saved group can have multiple concurrent drafts; use this to start an isolated line of edits.

func (*SavedGroupRevisions) Discard

Discard a draft revision Permanently discards a draft revision. Only open revisions (not merged or already-discarded) can be discarded.

func (*SavedGroupRevisions) GetSavedGroupRevision

GetSavedGroupRevision - Get a single saved group revision Returns the revision at the specified version for this saved group. Use `GET /saved-groups-revisions/{savedGroupId}/latest` for the most recent active draft.

func (*SavedGroupRevisions) Latest

Latest - Get the most recent active draft revision Returns the most recently updated open (non-merged, non-discarded) revision for the saved group. Returns 404 if there is no active draft. Pass `mine=true` to restrict to drafts authored by the calling user (requires a user-scoped API key).

func (*SavedGroupRevisions) ListForSavedGroup

ListForSavedGroup - List revisions for a saved group Returns a paginated list of revisions for this saved group, sorted newest-first. Optionally filtered by status, author, or the calling user's involvement.

func (*SavedGroupRevisions) ListSavedGroupRevisions

ListSavedGroupRevisions - List saved-group revisions across the organization Returns a paginated list of revisions across all saved groups in the organization, sorted newest-first. Optionally filtered by saved group, status, author, or the calling user's involvement.

func (*SavedGroupRevisions) MergeStatus

MergeStatus - Get merge status for a draft revision Runs a dry-run merge of the draft against the current live saved group and returns any conflicts. Use this before publishing to preview changes and detect conflicting edits.

func (*SavedGroupRevisions) Publish

Publish a draft revision Publishes a draft revision, making it the live state of the saved group. Blocked if the org requires approvals and the revision is not approved (callers with the bypass-approval permission may still publish).

func (*SavedGroupRevisions) Rebase

Rebase a draft revision onto the current live saved group Updates the draft's base snapshot to the current live state, applying the draft's changes on top. Supply `conflictResolutions` to resolve any conflicting fields. Strategies are `overwrite` (use the draft's value), `discard` (keep the live value), or `union` (merge arrays — use only on `values`). Optimistic locking is not enforced by this endpoint; callers who need strict locking should call `merge-status` before and after.

func (*SavedGroupRevisions) RemoveItems

RemoveItems - Remove items from a list saved group draft revision Removes the provided items from the draft's `values` array. Only valid for `list` saved groups. Pass `version: "new"` to auto-create a draft.

func (*SavedGroupRevisions) RequestReview

RequestReview - Request review for a draft revision Moves the draft from `draft` into `pending-review`. Notifies reviewers per the org's approval-flow settings.

Set `autoPublishOnApproval` to `true` to publish the revision automatically the moment it is approved (GitHub auto-merge model). This requires the org to have auto-publish-on-approval enabled and the caller to have publish permission on the saved group; the auto-publish then executes with the caller's authority.

func (*SavedGroupRevisions) Revert

Revert the saved group to a prior revision Creates a new draft (or immediately publishes) whose content matches the specified historical revision. Defaults to creating a draft; when the org enables 'reverts bypass approval' it defaults to publishing immediately. Pass `strategy` to override.

func (*SavedGroupRevisions) SetCondition

SetCondition - Update the condition of a condition saved group draft revision Stages a new JSON-encoded condition for the draft. Only valid for `condition` saved groups. Pass `version: "new"` to auto-create a draft.

func (*SavedGroupRevisions) SetMetadata

SetMetadata - Update saved group metadata in a draft revision Stages metadata changes (name, owner, description, projects) on the draft. Pass `version: "new"` to auto-create a draft. The change is only applied to the live saved group when the revision is merged.

func (*SavedGroupRevisions) SetValues

SetValues - Replace the values list in a list saved group draft revision Replaces the entire `values` array atomically. Only valid for `list` saved groups. For safe concurrent updates against a draft, prefer `POST .../items/add` and `POST .../items/remove`. Pass `version: "new"` to auto-create a draft.

func (*SavedGroupRevisions) SubmitReview

SubmitReview - Submit a review on a draft revision Submits an `approve`, `request-changes`, or `comment` review on the revision. Authors and contributors cannot submit `approve` reviews on their own drafts when the org has `blockSelfApproval` enabled.

When `decision` is `approve` and the revision has `autoPublishOnApproval` enabled, the revision is automatically published after approval. The response includes `autoPublished: true` when this happens. Pass `skipAutoPublish: true` to approve without triggering auto-publish.

type SavedGroups

type SavedGroups struct {
	// contains filtered or unexported fields
}

SavedGroups - Defined sets of attribute values which can be used with feature rules for targeting features at particular users.

func (*SavedGroups) ArchiveSavedGroup

ArchiveSavedGroup - Archive a single saved group

func (*SavedGroups) Create

Create a single saved group

func (*SavedGroups) DeleteSavedGroup

DeleteSavedGroup - Deletes a single saved group

func (*SavedGroups) GetSavedGroup

GetSavedGroup - Get a single saved group

func (*SavedGroups) GetSavedGroupReferences

GetSavedGroupReferences - Get features, experiments, and saved groups that reference this saved group

func (*SavedGroups) ListSavedGroups

ListSavedGroups - Get all saved group

func (*SavedGroups) UnarchiveSavedGroup

UnarchiveSavedGroup - Unarchive a single saved group

func (*SavedGroups) UpdateSavedGroup

UpdateSavedGroup - Partially update a single saved group

type Segments

type Segments struct {
	// contains filtered or unexported fields
}

Segments used during experiment analysis

func (*Segments) Create

Create a single segment

func (*Segments) DeleteSegment

DeleteSegment - Deletes a single segment

func (*Segments) GetSegment

GetSegment - Get a single segment

func (*Segments) ListSegments

ListSegments - Get all segments

func (*Segments) UpdateSegment

UpdateSegment - Update a single segment

type Settings

type Settings struct {
	// contains filtered or unexported fields
}

Settings - Get the organization settings.

func (*Settings) GetSettings

func (s *Settings) GetSettings(ctx context.Context, opts ...operations.Option) (*operations.GetSettingsResponse, error)

GetSettings - Get organization settings

type Snapshots

type Snapshots struct {
	// contains filtered or unexported fields
}

Experiment Snapshots (the individual updates of an experiment)

func (*Snapshots) CreateSnapshot

CreateSnapshot - Create Experiment Snapshot

func (*Snapshots) GetExperimentSnapshot

GetExperimentSnapshot - Get an experiment snapshot status

type Teams

type Teams struct {
	// contains filtered or unexported fields
}

func (*Teams) AddTeamMembers

AddTeamMembers - Add members to team

func (*Teams) CreateTeam

CreateTeam - Create a single team

func (*Teams) DeleteTeam

DeleteTeam - Delete a single team

func (*Teams) GetTeam

GetTeam - Get a single team

func (*Teams) ListTeams

func (s *Teams) ListTeams(ctx context.Context, opts ...operations.Option) (*operations.ListTeamsResponse, error)

ListTeams - Get all teams

func (*Teams) RemoveTeamMember

RemoveTeamMember - Remove members from team

func (*Teams) UpdateTeam

UpdateTeam - Update a single team

type UsageMetrics

type UsageMetrics struct {
	// contains filtered or unexported fields
}

func (*UsageMetrics) Get

Get metric usage across experiments Returns usage information for one or more legacy or fact metrics, showing which experiments use each metric and some usage statistics. If a metric is part of a metric group, then usage of that metric group counts as usage of all metrics in the group. Warning: only includes experiments that you have access to! If you do not have admin access or read access to experiments across all projects, this endpoint may not return the latest usage data across all experiments.

type VisualChangesets

type VisualChangesets struct {
	// contains filtered or unexported fields
}

VisualChangesets - Groups of visual changes made by the visual editor to a single page

func (*VisualChangesets) AddVisualChange

AddVisualChange - Create a visual change for a visual changeset

func (*VisualChangesets) Create

Create a visual changeset for an experiment

func (*VisualChangesets) GetVisualChangeset

GetVisualChangeset - Get a single visual changeset

func (*VisualChangesets) ListVisualChangesets

ListVisualChangesets - Get all visual changesets

func (*VisualChangesets) Update

Update a visual changeset

func (*VisualChangesets) UpdateVisualChange

UpdateVisualChange - Update a visual change for a visual changeset

Directories

Path Synopsis
models
sdkinternal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL