sdk

package
v3.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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) Get

Get a Product Analytics exploration

func (*AnalyticsExplorations) GetColumnValues

GetColumnValues - Fetch values for Product Analytics string columns

func (*AnalyticsExplorations) GetColumns

GetColumns - List columns available to a Product Analytics exploration

func (*AnalyticsExplorations) RunDataSource

RunDataSource - Create a Data Source based visualization

func (*AnalyticsExplorations) RunFactTable

RunFactTable - Run a Fact Table based visualization

func (*AnalyticsExplorations) RunFunnel

RunFunnel - Run a Funnel based visualization

func (*AnalyticsExplorations) RunJourney

RunJourney - Run a User Journey based visualization

func (*AnalyticsExplorations) RunMetric

RunMetric - Create a Metric based visualization

func (*AnalyticsExplorations) RunSQL

RunSQL - Create a SQL based visualization

func (*AnalyticsExplorations) Search

Search Product Analytics resources

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 AutoRuns

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

func (*AutoRuns) AppendArtifact

AppendArtifact - Record something an auto run created

func (*AutoRuns) CreateAutoRun

CreateAutoRun - Create a single autoRun

func (*AutoRuns) GetAutoRun

GetAutoRun - Get a single autoRun

func (*AutoRuns) ListAutoRuns

func (s *AutoRuns) ListAutoRuns(ctx context.Context, opts ...operations.Option) (*operations.ListAutoRunsResponse, error)

ListAutoRuns - Get all autoRuns

func (*AutoRuns) UpdateAutoRun

UpdateAutoRun - Update a single autoRun

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 - **Beta** — these endpoints are new and may change in backwards-incompatible ways.

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 the request body sets `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) DeleteProperty

DeleteProperty - Remove one property from a config draft revision's value Stages removal of a single property from this config's own value on the draft; the config then inherits that property from its parent (if any). Every other property is untouched. 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. Needs a personal access token, or an organization API key that assumes a named member's role.

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 the draft and makes its changes live. The caller needs Publish access for the affected environments. When approval is required, the draft must be approved unless the caller has Bypass draft approvals access. If the organization requires rebasing, an out-of-date draft must be rebased first; an authorized caller can instead send `ignoreWarnings: true` to force-publish it. A locked Config cannot be published. A 422 response lists every blocking gate and the available resolution. Publishing a schema change also normalizes descendant Configs according to their inheritance rules.

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), `discard` (keep the live value), or `union` (merge arrays without duplicates — for array fields like `extends`; pass a `customValues` entry to supply the resolved array yourself).

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) SetProperty

SetProperty - Set one property of a config draft revision's value Stages a single property of this config's own value on the draft, leaving every other property untouched. Prefer this over `PUT .../value` when changing one field: a whole-value write from a stale read silently drops properties someone else added in the meantime.

`null` is a value (it does not remove the property) — use `DELETE .../property` to remove one. Pass `version: "new"` to auto-create a draft.

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. The verdict belongs to whoever the request acts as; see [Naming who asked](/api/introduction#naming-who-asked). No one can rule on a draft they created. Submitting `approve` or `request-changes` needs Review access. A `comment` is participation rather than a verdict, so it is also open to the Comments permission or draft authority on the entity. 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.

func (*ConfigRevisions) UndoReview

UndoReview - Retract your own review verdict Retracts the calling user's own active `approve` or `request-changes` verdict, returning the revision to `pending-review`. Review comments stay in the log. Retracting a `request-changes` can leave the revision approved by someone else, in which case an armed auto-publish fires. The verdict belongs to whoever the request acts as; see [Naming who asked](/api/introduction#naming-who-asked). No one can rule on a draft they created.

type Configs

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

Configs - **Beta** — these endpoints are new and may change in backwards-incompatible ways.

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`. Inheritance is expressed via `parent`, never an in-value `@config:` entry. Values layer as a **deep, targeted patch**: a child (or a config-backed feature value) restates only the leaves it changes and inherits the rest — unlike a constant's `$extends`, whose own keys replace wholesale. 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 archiving would strip a value that live features or other configs still consume, the request returns a 422 listing the blocking gates — re-submit with `"ignoreWarnings": true` in the request body to acknowledge and proceed. A locked config, or one whose org requires approval, returns its own gate (unlock or route the change through a draft revision).

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 Locks the Config to its current published revision. Drafts can still be created and edited, but direct updates, publishes, scheduled publishes, reverts, and archives are blocked. The response returns the pinned revision in `lockedRevision`. Unlocking requires Bypass draft approvals access.

func (*Configs) UnarchiveConfig

UnarchiveConfig - Unarchive a single config

func (*Configs) UnlockConfig

UnlockConfig - Unlock a config Removes the Config lock so changes can be published again. The caller must have Bypass draft approvals access in the Config's Project.

func (*Configs) UpdateConfig

UpdateConfig - Partially update a single config Applies the change immediately and records it as a published revision, so it appears in history and fires revision webhooks. When the organization requires approvals, open a draft instead or pass `bypassApproval` with the bypass permission.

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 - **Beta** — these endpoints are new and may change in backwards-incompatible ways.

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. Needs a personal access token, or an organization API key that assumes a named member's role.

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 the draft and makes its changes live. The caller needs Publish access for the affected environments. When approval is required, the draft must be approved unless the caller has Bypass draft approvals access. If the organization requires rebasing, an out-of-date draft must be rebased first; an authorized caller can instead send `ignoreWarnings: true` to force-publish it. A 422 response lists every blocking gate and the available resolution.

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) 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 (*ConstantRevisions) 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 (*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) 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 Constant. A draft that still requires approval must request review first (or be armed with `bypassApproval` by a caller who can bypass).

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. The verdict belongs to whoever the request acts as; see [Naming who asked](/api/introduction#naming-who-asked). No one can rule on a draft they created. Submitting `approve` or `request-changes` needs Review access. A `comment` is participation rather than a verdict, so it is also open to the Comments permission or draft authority on the entity. 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.

func (*ConstantRevisions) UndoReview

UndoReview - Retract your own review verdict Retracts the calling user's own active `approve` or `request-changes` verdict, returning the revision to `pending-review`. Review comments stay in the log. Retracting a `request-changes` can leave the revision approved by someone else, in which case an armed auto-publish fires. The verdict belongs to whoever the request acts as; see [Naming who asked](/api/introduction#naming-who-asked). No one can rule on a draft they created.

type Constants

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

Constants - **Beta** — these endpoints are new and may change in backwards-incompatible ways.

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. A constant's own keys **replace** what its `$extends` bases provide, wholesale — constants are atomic building blocks. (Config and feature values compose as deep, targeted patches instead.)

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 Applies the change immediately and records it as a published revision, so it appears in history and fires revision webhooks. When the organization requires approvals, open a draft instead or pass `bypassApproval` with the bypass permission.

type ContextualBanditQueries

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

func (*ContextualBanditQueries) Create

Create a single contextualBanditQuery

func (*ContextualBanditQueries) Delete

Delete a single contextualBanditQuery

func (*ContextualBanditQueries) Get

Get a single contextualBanditQuery

func (*ContextualBanditQueries) ListContextualBanditQueries

ListContextualBanditQueries - Get all contextualBanditQueries

func (*ContextualBanditQueries) Update

Update a single contextualBanditQuery

type ContextualBandits

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

func (*ContextualBandits) AddLinkedFeature

AddLinkedFeature - Link a feature to a Contextual Bandit Adds a `contextual-bandit-ref` rule to the bottom of the feature's rule list and links the feature to this contextual bandit. The rule lands in a draft revision that auto-publishes when the contextual bandit starts, unless `autoPublish` is set. Targeting (condition, Saved Groups, prerequisites, coverage) is inherited from the contextual bandit and cannot be set on the rule.

func (*ContextualBandits) CancelContextualBandit

CancelContextualBandit - Cancel a running Contextual Bandit snapshot refresh

func (*ContextualBandits) CreateContextualBandit

CreateContextualBandit - Create a single contextualBandit

func (*ContextualBandits) DeleteLinkedFeature

DeleteLinkedFeature - Unlink a feature from a Contextual Bandit Removes every `contextual-bandit-ref` rule pointing at this contextual bandit from the feature and drops the feature from the bandit's linked-feature list. The rule removal lands in a draft revision unless `autoPublish` is set. When the feature has no such rule left, only the linkage is cleared.

func (*ContextualBandits) GetContextualBandit

GetContextualBandit - Get a single contextualBandit

func (*ContextualBandits) GetCurrentWeights

GetCurrentWeights - Get current Contextual Bandit leaf weights and latest event

func (*ContextualBandits) GetEvent

GetEvent - Get a single Contextual Bandit weight-update event

func (*ContextualBandits) GetResults

GetResults - Get latest Contextual Bandit results Returns the latest contextual-bandit stats engine output (per-context responses tagged with their leaf, the per-leaf targeting conditions, 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) GetSnapshot

GetSnapshot - Get a single Contextual Bandit snapshot

func (*ContextualBandits) ListContextualBandits

ListContextualBandits - Get all contextualBandits

func (*ContextualBandits) ListEvents

ListEvents - List Contextual Bandit weight-update events

func (*ContextualBandits) ListLinkedFeatures

ListLinkedFeatures - 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) ListSnapshots

ListSnapshots - List Contextual Bandit snapshots

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

func (*ContextualBandits) UpdateLinkedFeature

UpdateLinkedFeature - Replace a Contextual Bandit's rule on a linked feature Replaces every `contextual-bandit-ref` rule pointing at this contextual bandit on the feature, keeping each rule's id and position in the rule list. Every field is replaced, so omitted optional fields revert to their defaults. Returns a 400 when the feature has no such rule on the target revision, or when it has several that are not identical to each other. The change lands in a draft revision that auto-publishes when the contextual bandit starts, unless `autoPublish` is set. Targeting (condition, Saved Groups, prerequisites, coverage) is inherited from the contextual bandit and cannot be set on the rule.

func (*ContextualBandits) UpdateVariations

UpdateVariations - Add or remove Contextual Bandit variations Adds and/or removes variations on a Contextual Bandit. Send `addVariations` and `removeVariationIds` independently; both are optional. New arms must carry a `values` entry for each linked feature. Running CBs publish the linked-feature updates; draft CBs stage them until start. Under an approval flow, unapproved drafts leave the added arm `pending` (zero weight, filtered from the SDK) until every linked feature's draft is live. Removed arms are tombstoned; their ids can never be re-added. Weights are reconciled server-side.

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) Create

Create a single dashboard

func (*Dashboards) CreateV1 deprecated

CreateV1 - Create a single dashboard **Deprecated.** Use [POST /v2/dashboards](#operation/createDashboardV2) instead.

This endpoint does not accept an `owner` and always assigns the dashboard to the authenticated user. A dashboard created with an organization secret API key, which has no associated user, therefore has no owner. The v2 endpoint accepts an `owner` (userId or email) and requires one when authenticating with an organization secret API key.

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

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) GetWarehouseTableSchema

GetWarehouseTableSchema - Get warehouse table schemas

func (*DataSources) ListDataSources

ListDataSources - Get all data sources

func (*DataSources) PreviewWarehouseColumnValues

PreviewWarehouseColumnValues - Preview distinct column values

func (*DataSources) RunSQLQuery

RunSQLQuery - Execute a read-only SQL query

func (*DataSources) SearchWarehouseTables

SearchWarehouseTables - Search warehouse tables

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 Creates a new experiment.

### Naming for human review

Keep `name` short; put reasoning in `hypothesis` and context in `description`. `trackingKey` is sent with exposure events, so keep it short and stable.

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) PostComment

PostComment - Post a comment on an experiment Adds a new comment to an experiment's discussion thread, credited to the person behind the request. Needs a personal access token, or an organization API key that assumes a named member's role.

func (*Experiments) Results

Results - Get results for an experiment

func (*Experiments) SetSchedule

SetSchedule - Set an experiment's schedule and shipping automation Full-replace of the experiment's scheduled start/end and end-of-experiment shipping automation. The body is the complete desired state: any omitted field is cleared (omit `startAt` to remove a scheduled start; send an empty body to clear the whole schedule). Provide either `stopAt` or `stopAfter`, not both; a relative `stopAfter` resolves to a concrete stop when the experiment starts. Setting a scheduled end (`stopAt` or `stopAfter`) requires a `scheduledStopPlan` (any mode, including `notify`). The scheduled end must be in the future: a `stopAt` (or a `stopAfter` that resolves) in the past is rejected — including one whose end date has already passed and been acted on, so changing the plan after a soft end requires committing to a new end date. Auto-ship shipping requires the Decision Framework.

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 Creates or updates Fact Tables, Fact Table filters, and Fact Metrics. Resources upsert by `id`. Pass `dryRun: true` to validate with zero writes. Not transactional: a live mid-loop failure returns HTTP 400 (403 for a permission failure) with write counts and `errors`.

func (*FactTables) Create

Create a single fact table

func (*FactTables) CreateFilter

CreateFilter - Create a single fact table filter

func (*FactTables) CreateVirtualColumn

CreateVirtualColumn - Create a virtual (computed) column on a fact table

func (*FactTables) DeleteFactTable

DeleteFactTable - Deletes a single fact table

func (*FactTables) DeleteFilter

DeleteFilter - Deletes a single fact table filter

func (*FactTables) DeleteVirtualColumn

DeleteVirtualColumn - Delete a virtual (computed) column from a fact table

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

func (*FactTables) UpdateVirtualColumn

UpdateVirtualColumn - Update a virtual (computed) column on a fact table

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 Publishes the draft and makes its changes live. The caller needs Publish access for every affected environment. When approval is required, the draft must be approved unless the caller has Bypass draft approvals access. If the organization requires rebasing, an out-of-date draft must be rebased first; an authorized caller can instead send `ignoreWarnings: true` to force-publish it. Any pending ramp actions in `pendingRamp` are applied as part of the same operation. A 422 response lists every blocking gate and the available resolution.

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 Schedules the draft to publish on or after `scheduledPublishAt`. When approval is required, publishing waits until the draft is also approved. Send `scheduledPublishAt: null` to cancel the schedule.

Set `lockEdits` to prevent content changes while the schedule is pending; rebasing remains allowed. Set `lockOthers` to prevent other drafts of this Feature Flag from being published until this schedule runs or is canceled. The caller needs Publish access, and that access is checked again when the schedule runs. A caller with Bypass draft approvals access can schedule an unapproved draft by sending `bypassApproval: true`. That schedule must be canceled and recreated before it can be changed.

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. The verdict belongs to whoever the request acts as; see [Naming who asked](/api/introduction#naming-who-asked). No one can rule on a draft they created. 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 verdict belongs to whoever the request acts as; see [Naming who asked](/api/introduction#naming-who-asked). No one can rule on a draft they created. 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. Needs a personal access token, or an organization API key that assumes a named member's role.

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.

Publishes the draft and makes its changes live. The caller needs Publish access for every affected environment. When approval is required, the draft must be approved unless the caller has Bypass draft approvals access.

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. The verdict belongs to whoever the request acts as; see [Naming who asked](/api/introduction#naming-who-asked). No one can rule on a draft they created. 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 programmatically.

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 Flag. The caller needs Create access in its Project, plus Publish access for any environment the Feature Flag starts enabled in — one that starts disabled everywhere needs Create alone. Rules are supplied as a top-level `rules` array; each rule includes `allEnvironments` / `environments` scope fields.

### Naming for human review

The `id` is the Feature Flag's permanent name in the UI and code. Keep it short (`checkout-express-pay`) and put context in `description`. To create it disabled, list every environment in `environments` with `enabled: false`.

### 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 Feature 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 Flag and all of its revisions. The caller needs Archive & delete access. Deleting a live Feature Flag also requires Publish access for every environment where it is enabled and the organization setting "REST API always bypasses approval requirements". Otherwise, archive the Feature Flag before deleting it.

func (*Features) Get

Get a single feature

func (*Features) GetStale

GetStale - 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) ListKeys

ListKeys - Get list of feature keys

func (*Features) Revert

Revert a feature to a specific revision Restores a previously published revision and immediately publishes the result as a new revision. The caller needs Revert access for every affected environment. When approval is required, the request is allowed only if the caller holds the `FlagsBypassApprovals` policy, or the organization enables either "REST API always bypasses approval requirements" or "Allow reverts without approval".

If the restored values no longer match the Feature Flag's current value type or JSON schema, or restoring an archived state would archive a flag that live flags or experiments still depend on, the API returns 422 with `warnings`. Send `"ignoreWarnings": true` to acknowledge those warnings and continue.

func (*Features) Toggle

Toggle a feature in one or more environments Enables or disables a Feature Flag in one or more environments and immediately publishes the change. The caller needs Publish access for every environment in the request. When approval is required, use a draft revision instead, unless the caller can bypass draft approvals.

func (*Features) Update

Update - Partially update a feature Updates the Feature Flag and immediately publishes a new revision. The caller needs Edit access in the Feature Flag's Project and Publish access for every affected environment. When approval is required, use the revision endpoints instead, unless the caller can bypass draft approvals.

Other top-level fields are patch-merged: omit a field to leave it unchanged. The `rules` field, when supplied, replaces the entire `rules` array in one operation. To preserve existing rules, fetch the Feature Flag, update the returned `rules` array, and send the complete array back. Safe-rollout rules round-trip through `safeRolloutId`; use `POST /v2/features/:id/revisions/:version/rules` to create new ones.

type FeaturesV1

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

FeaturesV1 - Control your feature flags programmatically.

**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 Flag and all of its revisions. The caller needs Archive & delete access. Deleting a live Feature Flag also requires Publish access for every environment where it is enabled and the organization setting "REST API always bypasses approval requirements". Otherwise, archive the Feature Flag before deleting it.

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) GetStale deprecated

GetStale - 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) ListKeys deprecated

ListKeys - 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) Revert deprecated

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

Restores a previously published revision and immediately publishes the result as a new revision. The caller needs Revert access for every affected environment. When approval is required, the request is allowed only if the caller holds the `FlagsBypassApprovals` policy, or the organization enables either "REST API always bypasses approval requirements" or "Allow reverts without approval".

If the restored values no longer match the Feature Flag's current value type or JSON schema, or restoring an archived state would archive a flag that live flags or experiments still depend on, the API returns 422 with `warnings`. Send `"ignoreWarnings": true` to acknowledge those warnings and continue.

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 Flag in one or more environments and immediately publishes the change. The caller needs Publish access for every environment in the request. When approval is required, use a draft revision instead, unless the caller can bypass draft approvals.

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 the Feature Flag and immediately publishes a new revision. The caller needs Edit access in the Feature Flag's Project and Publish access for every affected environment. When approval is required, use the revision endpoints instead, unless the caller can bypass draft approvals.

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 programmatically.
	//
	// **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 programmatically.
	//
	// 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
	// Groups of visual changes made by the visual editor to a single page
	VisualChangesets  *VisualChangesets
	ContextualBandits *ContextualBandits
	// Experiment Snapshots (the individual updates of an experiment)
	Snapshots *Snapshots
	// 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
	// **Beta** — these endpoints are new and may change in backwards-incompatible ways.
	//
	// 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. A constant's own keys **replace** what its `$extends` bases provide, wholesale — constants are atomic building blocks. (Config and feature values compose as deep, targeted patches instead.)
	Constants *Constants
	// **Beta** — these endpoints are new and may change in backwards-incompatible ways.
	//
	// 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
	// **Beta** — these endpoints are new and may change in backwards-incompatible ways.
	//
	// 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`. Inheritance is expressed via `parent`, never an in-value `@config:` entry. Values layer as a **deep, targeted patch**: a child (or a config-backed feature value) restates only the leaves it changes and inherits the rest — unlike a constant's `$extends`, whose own keys replace wholesale. 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
	// **Beta** — these endpoints are new and may change in backwards-incompatible ways.
	//
	// 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 the request body sets `ignoreWarnings: true`. Pass `version: "new"` on edit endpoints to auto-create a draft.
	ConfigRevisions *ConfigRevisions
	// **Beta** — these endpoints are new and may change in backwards-incompatible ways.
	//
	// Coordinated multi-entity publishing: publish a set of revisions across Feature Flags, Saved Groups, configs, and constants as one all-or-nothing operation, validated against the combined end-state instead of each in-between state. Requires the `releases` commercial feature.
	Releases *Releases
	// 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
	// Saved learnings captured across experiments, including AI-discovered patterns.
	Learnings *Learnings
	// Hold a share of traffic out of all experiments to measure their combined effect.
	Holdouts *Holdouts
	AutoRuns *AutoRuns
	// **Beta** — these endpoints are new and may change in backwards-incompatible ways.
	//
	// Populations define a set of units by the steps they must complete, such as appearing in a fact table. Populations are not yet used in analysis.
	Populations *Populations
	// 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 Holdouts

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

Holdouts - Hold a share of traffic out of all experiments to measure their combined effect.

func (*Holdouts) CreateHoldout

CreateHoldout - Create a single holdout Creates a Holdout. The Holdout starts in the `draft` stage. Use the start endpoint to start it.

func (*Holdouts) GetHoldout

GetHoldout - Get a single holdout

func (*Holdouts) ListHoldouts

ListHoldouts - Get all holdouts

func (*Holdouts) StartAnalysis

StartAnalysis - Start the Holdout's Analysis Period Move the holdout into an analysis phase. New Feature Flags and Experiments can no longer be added, but existing traffic splits remain active for existing and new traffic. Results exclude data from before the analysis period so you can measure the cumulative impact after changes are frozen.

func (*Holdouts) StartHoldout

StartHoldout - Start the Holdout's Active Period Feature Flags and Experiments can be added during this period while the Holdout measures their cumulative impact.

func (*Holdouts) StopHoldout

StopHoldout - Stop a Holdout

func (*Holdouts) UpdateHoldout

UpdateHoldout - Update a single holdout Updates a Holdout. Use the start, start-analysis, and stop endpoints to move it through its lifecycle.

type Learnings

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

Learnings - Saved learnings captured across experiments, including AI-discovered patterns.

func (*Learnings) CreateLearning

CreateLearning - Create a single learning

func (*Learnings) DeleteLearning

DeleteLearning - Delete a single learning

func (*Learnings) GetLearning

GetLearning - Get a single learning

func (*Learnings) ListLearnings

ListLearnings - Get all learnings

func (*Learnings) SearchLearnings

SearchLearnings - Search saved Learnings by meaning rather than keyword

func (*Learnings) UpdateLearning

UpdateLearning - Update a single learning

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) UpdateRole

UpdateRole - Update a member's role Update a member's global role (including any environment 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) GetConfirmation

GetConfirmation - Get a confirmation Poll a held request until a person confirms or rejects it in GrowthBook. Pass `wait` (seconds, max 30) to hold the request open until the status changes.

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) ListExperiments

ListExperiments - Get results for all experiments that use a metric Returns, for each experiment that uses the given metric (directly or via a metric group), the per-variation results for that metric from the latest snapshot. Supports the same filtering as the experiment list views via a raw search string or structured query params. Note: at most the 1000 most recent experiments using the metric are considered; filters and pagination are applied within that set, so results may be incomplete for metrics used by more than 1000 experiments.

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 Populations

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

Populations - **Beta** — these endpoints are new and may change in backwards-incompatible ways.

Populations define a set of units by the steps they must complete, such as appearing in a fact table. Populations are not yet used in analysis.

func (*Populations) CreatePopulation

CreatePopulation - Create a single population

func (*Populations) DeletePopulation

DeletePopulation - Delete a single population

func (*Populations) GetPopulation

GetPopulation - Get a single population

func (*Populations) ListPopulations

ListPopulations - Get all populations

func (*Populations) UpdatePopulation

UpdatePopulation - Update a single population

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 `FlagsBypassApprovals` 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.

This skips the revision review flow, so when the organization requires review anywhere it is limited to credentials that may bypass approval. The reviewed way to attach a plan is `PUT /features/{id}/revisions/{version}/rules/{ruleId}/ramp-schedule` followed by a publish.

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 Creates a ramp schedule, optionally attached to a published feature rule by passing `featureId` and `ruleId` together (the target is then injected into every action). Attaching on creation skips the revision review flow, so when the organization requires review anywhere it is limited to credentials that may bypass approval. The reviewed way to attach a plan is `PUT /features/{id}/revisions/{version}/rules/{ruleId}/ramp-schedule` followed by a publish. Without a target the schedule is a free-standing skeleton in `pending` status. Requires a Pro plan or above.

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) GetStatus

GetStatus - 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) UpdateLockdown

UpdateLockdown - 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) UpdateMonitoring

UpdateMonitoring - Update ramp monitoring configuration Replaces the monitoring configuration. Health-action thresholds (`srmAction`, `noTrafficAction`, etc.) can be updated at any time.

Once a linked SafeRollout has started, `datasourceId`, `exposureQueryId`, the metric IDs and the snapshot cadence are all locked — 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) 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.

Changing `steps`, `startActions`, `endActions`, `startDate`, or `cutoffDate` on a schedule that is attached to a rule skips the revision review flow, so when the organization requires review anywhere it is limited to credentials that may bypass approval. Otherwise stage a new plan on a draft revision and publish it.

**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) UpdateSteps

UpdateSteps - 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.

On a schedule attached to a rule this skips the revision review flow, so when the organization requires review anywhere it is limited to credentials that may bypass approval.

**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 Releases

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

Releases - **Beta** — these endpoints are new and may change in backwards-incompatible ways.

Coordinated multi-entity publishing: publish a set of revisions across Feature Flags, Saved Groups, configs, and constants as one all-or-nothing operation, validated against the combined end-state instead of each in-between state. Requires the `releases` commercial feature.

func (*Releases) PublishRevisions

PublishRevisions - Atomically publish revisions across multiple entities Publishes a set of revisions — at most one per entity — across Feature Flags, Saved Groups, configs, and constants as a single all-or-nothing operation.

Validation, guards, and custom hooks run against the combined end-state of the whole set, so interdependent changes (e.g. a config schema change plus the values that depend on it) publish together even when the in-between states would be invalid.

A blocked publish returns one 422 listing every gate across every item and the flag that clears each. A concurrent change to any target aborts with a 409 and nothing publishes. A failure after the commit starts rolls everything back and emits `revision.publishFailed` for each revision in the set. SDK payloads refresh once per request. Pass `dryRun: true` for the full gate report with zero writes.

Requires the `releases` commercial feature.

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) Lookup

Lookup - 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. Needs a personal access token, or an organization API key that assumes a named member's role.

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 the draft and applies its changes to the live Saved Group. The caller needs Publish access in every assigned Project. When approval is required, the draft must be approved unless the caller has Bypass draft approvals access. If the organization requires rebasing, an out-of-date draft must be rebased first; an authorized caller can instead send `ignoreWarnings: true` to force-publish it. A 422 response lists every blocking gate and the available resolution.

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) 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 (*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) 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 (*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) 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 Saved Group. A draft that still requires approval must request review first (or be armed with `bypassApproval` by a caller who can bypass).

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. The verdict belongs to whoever the request acts as; see [Naming who asked](/api/introduction#naming-who-asked). No one can rule on a draft they created. Submitting `approve` or `request-changes` needs Review access. A `comment` is participation rather than a verdict, so it is also open to the Comments permission or draft authority on the entity. 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.

func (*SavedGroupRevisions) UndoReview

UndoReview - Retract your own review verdict Retracts the calling user's own active `approve` or `request-changes` verdict, returning the revision to `pending-review`. Review comments stay in the log. Retracting a `request-changes` can leave the revision approved by someone else, in which case an armed auto-publish fires. The verdict belongs to whoever the request acts as; see [Naming who asked](/api/introduction#naming-who-asked). No one can rule on a draft they created.

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 Archives a Saved Group. If it is still referenced by a Feature Flag, experiment, or another Saved Group, the API returns 422 with the affected references. Send `"ignoreWarnings": true` to acknowledge those references and continue. When approval is required, create and publish an archive revision instead, or use a caller with Bypass draft approvals access. A successful response lists any skipped gates in `bypassedGates`.

func (*SavedGroups) Create

Create a single saved group

func (*SavedGroups) DeleteSavedGroup

DeleteSavedGroup - Deletes a single saved group

func (*SavedGroups) GetReferences

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

func (*SavedGroups) GetSavedGroup

GetSavedGroup - Get a single saved group

func (*SavedGroups) ListSavedGroups

ListSavedGroups - Get all saved group

func (*SavedGroups) UnarchiveSavedGroup

UnarchiveSavedGroup - Unarchive a single saved group Unarchives a Saved Group. When approval is required, create and publish an unarchive revision instead, or use a caller with Bypass draft approvals access. A successful response lists any skipped gates in `bypassedGates`.

func (*SavedGroups) UpdateSavedGroup

UpdateSavedGroup - Partially update a single saved group Applies the change immediately and records it as a published revision, so it appears in history and fires revision webhooks. When the organization requires approvals, open a draft instead or pass `bypassApproval` with the bypass permission.

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

func (*Settings) SetApprovals

SetApprovals - Update approval settings Replace the approval requirements for feature flags, configs and constants, for saved groups, and the Targeting Projects review mode. Each family is replaced wholesale when supplied; omit one to leave it unchanged.

type Snapshots

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

Experiment Snapshots (the individual updates of an experiment)

func (*Snapshots) GetExperimentSnapshot

GetExperimentSnapshot - Get an experiment snapshot status

type Teams

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

func (*Teams) AddMembers

AddMembers - 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) RemoveMembers

RemoveMembers - 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