Skip to content

Create a project from a project document

POST
/projects/import
curl --request POST \
--url 'https://example.com/api/v1/projects/import?dry_run=false' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '"binary"'

Creates a project holding exactly the document: its environments (at least one), unit types, declared attributes, segments, flags with their configuration in every environment and experiments, besides the standard attributes every project has; no default environment or unit type is added. The document is sent as application/json or application/yaml, as GET /projects/{project}/export writes it, and its sections are all required. key and name replace the document’s project key and name.

The copy keeps every rule identifier and rollout salt the document names, so every unit is bucketed as in the original; a rule or a rollout without one is given one. An owner the document names by email owns the entity when they may own in the new project, which no member but an instance admin may yet; otherwise the importing member does and the answer warns owner_replaced with the address. Protection is bypassed in every environment, which take protected from the document.

Every experiment is created exactly as the document has it, its status, both salts, its timestamps and its decision, so that a unit keeps its assignment; a draft may leave its salts out and is given two. It is judged as a create is, and by the history its status leaves behind. A draft and a running experiment need a flag that is not archived and a declared unit type, a stopped one a declared unit type, and an archived one neither. No salt is shared by two experiments, or by an experiment and a rollout.

The import applies whole or not at all. A document that breaks a rule is refused 422 invalid_document with every fault found in errors, each pointing into the document; schema_version_unsupported names the versions this server reads. A key in use is 409 already_exists. With dry_run the whole import runs, every check the database makes included, and is rolled back: same answer, 200, nothing written.

Every entity created is recorded as a direct write records it, then one project.imported entry, all with the request’s identifier; each environment’s ruleset moves on once. A body is accepted up to 32 MiB.

key
string

The new project’s key, replacing the document’s.

name
string

The new project’s name, replacing the document’s.

dry_run
boolean

Run the whole import and roll it back, answering what it would have done.

A ProjectDocument as JSON.

string format: binary

Example generated

binary

The project the document would create, for a dry run.

Media typeapplication/json

What an import did, or with a dry run what it would do.

object
project
required
object
key
required
string
name
required
string
description
string
mode
required
string
Allowed values: create merge replace
source
required
string
Allowed values: document firebase
dry_run
required
boolean
changes
required

The keys of the entities an import created, updated and deleted, by kind. Standard attributes are never in it.

object
environments
required
object
created
required
Array<string>
updated
required
Array<object>
object
key
required
string
patch
required

An RFC 6902 JSON Patch turning the entity as it was into the entity as it is, over its entry of the document.

Array<object>
object
op
required
string
Allowed values: add remove replace move copy test
path
required
string
from
string
value
deleted
required
Array<string>
unit_types
required
object
created
required
Array<string>
updated
required
Array<object>
object
key
required
string
patch
required

An RFC 6902 JSON Patch turning the entity as it was into the entity as it is, over its entry of the document.

Array<object>
object
op
required
string
Allowed values: add remove replace move copy test
path
required
string
from
string
value
deleted
required
Array<string>
attributes
required
object
created
required
Array<string>
updated
required
Array<object>
object
key
required
string
patch
required

An RFC 6902 JSON Patch turning the entity as it was into the entity as it is, over its entry of the document.

Array<object>
object
op
required
string
Allowed values: add remove replace move copy test
path
required
string
from
string
value
deleted
required
Array<string>
segments
required
object
created
required
Array<string>
updated
required
Array<object>
object
key
required
string
patch
required

An RFC 6902 JSON Patch turning the entity as it was into the entity as it is, over its entry of the document.

Array<object>
object
op
required
string
Allowed values: add remove replace move copy test
path
required
string
from
string
value
deleted
required
Array<string>
flags
required
object
created
required
Array<string>
updated
required
Array<object>
object
key
required
string
patch
required

An RFC 6902 JSON Patch turning the entity as it was into the entity as it is, over its entry of the document.

Array<object>
object
op
required
string
Allowed values: add remove replace move copy test
path
required
string
from
string
value
deleted
required
Array<string>
experiments
required
object
created
required
Array<string>
updated
required
Array<object>
object
key
required
string
patch
required

An RFC 6902 JSON Patch turning the entity as it was into the entity as it is, over its entry of the document.

Array<object>
object
op
required
string
Allowed values: add remove replace move copy test
path
required
string
from
string
value
deleted
required
Array<string>
warnings
required
Array<object>

Something an import did differently from what the document asks, or could not do, without refusing it.

object
code
required

Stable name of the warning, such as owner_replaced.

string
pointer
required

A JSON Pointer into the document, empty for the document as a whole.

string
detail
required
string
params

The values a client explains the warning with, such as the email of an owner replaced.

object
key
additional properties
any

Example

{
"mode": "create",
"source": "document",
"changes": {
"environments": {
"updated": [
{
"patch": [
{
"op": "add"
}
]
}
]
},
"unit_types": {
"updated": [
{
"patch": [
{
"op": "add"
}
]
}
]
},
"attributes": {
"updated": [
{
"patch": [
{
"op": "add"
}
]
}
]
},
"segments": {
"updated": [
{
"patch": [
{
"op": "add"
}
]
}
]
},
"flags": {
"updated": [
{
"patch": [
{
"op": "add"
}
]
}
]
},
"experiments": {
"updated": [
{
"patch": [
{
"op": "add"
}
]
}
]
}
}
}

The project created.

Media typeapplication/json

What an import did, or with a dry run what it would do.

object
project
required
object
key
required
string
name
required
string
description
string
mode
required
string
Allowed values: create merge replace
source
required
string
Allowed values: document firebase
dry_run
required
boolean
changes
required

The keys of the entities an import created, updated and deleted, by kind. Standard attributes are never in it.

object
environments
required
object
created
required
Array<string>
updated
required
Array<object>
object
key
required
string
patch
required

An RFC 6902 JSON Patch turning the entity as it was into the entity as it is, over its entry of the document.

Array<object>
object
op
required
string
Allowed values: add remove replace move copy test
path
required
string
from
string
value
deleted
required
Array<string>
unit_types
required
object
created
required
Array<string>
updated
required
Array<object>
object
key
required
string
patch
required

An RFC 6902 JSON Patch turning the entity as it was into the entity as it is, over its entry of the document.

Array<object>
object
op
required
string
Allowed values: add remove replace move copy test
path
required
string
from
string
value
deleted
required
Array<string>
attributes
required
object
created
required
Array<string>
updated
required
Array<object>
object
key
required
string
patch
required

An RFC 6902 JSON Patch turning the entity as it was into the entity as it is, over its entry of the document.

Array<object>
object
op
required
string
Allowed values: add remove replace move copy test
path
required
string
from
string
value
deleted
required
Array<string>
segments
required
object
created
required
Array<string>
updated
required
Array<object>
object
key
required
string
patch
required

An RFC 6902 JSON Patch turning the entity as it was into the entity as it is, over its entry of the document.

Array<object>
object
op
required
string
Allowed values: add remove replace move copy test
path
required
string
from
string
value
deleted
required
Array<string>
flags
required
object
created
required
Array<string>
updated
required
Array<object>
object
key
required
string
patch
required

An RFC 6902 JSON Patch turning the entity as it was into the entity as it is, over its entry of the document.

Array<object>
object
op
required
string
Allowed values: add remove replace move copy test
path
required
string
from
string
value
deleted
required
Array<string>
experiments
required
object
created
required
Array<string>
updated
required
Array<object>
object
key
required
string
patch
required

An RFC 6902 JSON Patch turning the entity as it was into the entity as it is, over its entry of the document.

Array<object>
object
op
required
string
Allowed values: add remove replace move copy test
path
required
string
from
string
value
deleted
required
Array<string>
warnings
required
Array<object>

Something an import did differently from what the document asks, or could not do, without refusing it.

object
code
required

Stable name of the warning, such as owner_replaced.

string
pointer
required

A JSON Pointer into the document, empty for the document as a whole.

string
detail
required
string
params

The values a client explains the warning with, such as the email of an owner replaced.

object
key
additional properties
any

Example

{
"mode": "create",
"source": "document",
"changes": {
"environments": {
"updated": [
{
"patch": [
{
"op": "add"
}
]
}
]
},
"unit_types": {
"updated": [
{
"patch": [
{
"op": "add"
}
]
}
]
},
"attributes": {
"updated": [
{
"patch": [
{
"op": "add"
}
]
}
]
},
"segments": {
"updated": [
{
"patch": [
{
"op": "add"
}
]
}
]
},
"flags": {
"updated": [
{
"patch": [
{
"op": "add"
}
]
}
]
},
"experiments": {
"updated": [
{
"patch": [
{
"op": "add"
}
]
}
]
}
}
}

invalid_request: a parameter that is malformed or out of its range, such as a cursor this API did not return.

Media typeapplication/problem+json

A problem document (RFC 9457). Code-specific values are further members.

object
type
required
string
title
required
string
status
required
integer
code
required

Stable snake_case name of the problem, which clients branch on.

string
detail

An English explanation for humans; never what a client branches on.

string
request_id
required
string
retry_after

Seconds to wait before retrying, for a rate limit.

integer
permission

The permission the caller lacks, for forbidden, or the role’s permission the caller lacks, for role_not_allowed.

string
current_version

The version the entity has now, for version_mismatch.

integer format: int64
references

What still names what the write would remove or hide, for in_use.

Array<object>
object
kind
required

What names it, such as flag, segment or experiment.

string
key
required
string
environment
required

The key of the environment it is named in; null when it is named in every environment.

string
nullable
provider

The slug of the auth provider to sign in through instead, for sso_required.

string
used_by

What keeps an auth provider from being deleted, disabled or edited, for provider_in_use, such as identities, enforced domains or only way in (the only enabled provider while local login is disabled).

Array<string>
failure

Why a system the server asked did not answer as needed, for provider_unreachable; for sink_not_ready the failure class of the target’s check, such as connect or status.

string
failure_status

The HTTP status the target answered, for sink_not_ready, when it answered.

integer
failure_code

The target’s own error code, for sink_not_ready, when it speaks one, such as a ClickHouse exception or an S3 error code.

string
errors
Array<object>
object
pointer
required

JSON Pointer into the request body.

string
code
required
string
detail
required
string
params

The values of the rule broken, such as the bounds of a length, for a client to explain the violation in its own language.

object
key
additional properties
any

Example generated

{
"type": "example",
"title": "example",
"status": 1,
"code": "example",
"detail": "example",
"request_id": "example",
"retry_after": 1,
"permission": "example",
"current_version": 1,
"references": [
{
"kind": "example",
"key": "example",
"environment": "example"
}
],
"provider": "example",
"used_by": [
"example"
],
"failure": "example",
"failure_status": 1,
"failure_code": "example",
"errors": [
{
"pointer": "example",
"code": "example",
"detail": "example",
"params": {}
}
]
}

No credential, or one that is not accepted: unauthenticated without a credential (a session cookie the server did not issue counts as none); invalid_token, token_revoked or token_expired for an API token, with a WWW-Authenticate header naming the code; session_expired for a session that has ended, whose cookie is cleared; invalid_credentials for a sign-in.

Media typeapplication/problem+json

A problem document (RFC 9457). Code-specific values are further members.

object
type
required
string
title
required
string
status
required
integer
code
required

Stable snake_case name of the problem, which clients branch on.

string
detail

An English explanation for humans; never what a client branches on.

string
request_id
required
string
retry_after

Seconds to wait before retrying, for a rate limit.

integer
permission

The permission the caller lacks, for forbidden, or the role’s permission the caller lacks, for role_not_allowed.

string
current_version

The version the entity has now, for version_mismatch.

integer format: int64
references

What still names what the write would remove or hide, for in_use.

Array<object>
object
kind
required

What names it, such as flag, segment or experiment.

string
key
required
string
environment
required

The key of the environment it is named in; null when it is named in every environment.

string
nullable
provider

The slug of the auth provider to sign in through instead, for sso_required.

string
used_by

What keeps an auth provider from being deleted, disabled or edited, for provider_in_use, such as identities, enforced domains or only way in (the only enabled provider while local login is disabled).

Array<string>
failure

Why a system the server asked did not answer as needed, for provider_unreachable; for sink_not_ready the failure class of the target’s check, such as connect or status.

string
failure_status

The HTTP status the target answered, for sink_not_ready, when it answered.

integer
failure_code

The target’s own error code, for sink_not_ready, when it speaks one, such as a ClickHouse exception or an S3 error code.

string
errors
Array<object>
object
pointer
required

JSON Pointer into the request body.

string
code
required
string
detail
required
string
params

The values of the rule broken, such as the bounds of a length, for a client to explain the violation in its own language.

object
key
additional properties
any

Example generated

{
"type": "example",
"title": "example",
"status": 1,
"code": "example",
"detail": "example",
"request_id": "example",
"retry_after": 1,
"permission": "example",
"current_version": 1,
"references": [
{
"kind": "example",
"key": "example",
"environment": "example"
}
],
"provider": "example",
"used_by": [
"example"
],
"failure": "example",
"failure_status": 1,
"failure_code": "example",
"errors": [
{
"pointer": "example",
"code": "example",
"detail": "example",
"params": {}
}
]
}
WWW-Authenticate
string

The caller may not perform the operation: forbidden (with the missing permission), session_required, insufficient_scope, cross_origin for a request signed in by the session cookie, a read included, that the browser says comes from another origin, or, for a write, change_request_required when it would change what a protected environment’s SDKs receive; detail names those environments.

Media typeapplication/problem+json

A problem document (RFC 9457). Code-specific values are further members.

object
type
required
string
title
required
string
status
required
integer
code
required

Stable snake_case name of the problem, which clients branch on.

string
detail

An English explanation for humans; never what a client branches on.

string
request_id
required
string
retry_after

Seconds to wait before retrying, for a rate limit.

integer
permission

The permission the caller lacks, for forbidden, or the role’s permission the caller lacks, for role_not_allowed.

string
current_version

The version the entity has now, for version_mismatch.

integer format: int64
references

What still names what the write would remove or hide, for in_use.

Array<object>
object
kind
required

What names it, such as flag, segment or experiment.

string
key
required
string
environment
required

The key of the environment it is named in; null when it is named in every environment.

string
nullable
provider

The slug of the auth provider to sign in through instead, for sso_required.

string
used_by

What keeps an auth provider from being deleted, disabled or edited, for provider_in_use, such as identities, enforced domains or only way in (the only enabled provider while local login is disabled).

Array<string>
failure

Why a system the server asked did not answer as needed, for provider_unreachable; for sink_not_ready the failure class of the target’s check, such as connect or status.

string
failure_status

The HTTP status the target answered, for sink_not_ready, when it answered.

integer
failure_code

The target’s own error code, for sink_not_ready, when it speaks one, such as a ClickHouse exception or an S3 error code.

string
errors
Array<object>
object
pointer
required

JSON Pointer into the request body.

string
code
required
string
detail
required
string
params

The values of the rule broken, such as the bounds of a length, for a client to explain the violation in its own language.

object
key
additional properties
any

Example generated

{
"type": "example",
"title": "example",
"status": 1,
"code": "example",
"detail": "example",
"request_id": "example",
"retry_after": 1,
"permission": "example",
"current_version": 1,
"references": [
{
"kind": "example",
"key": "example",
"environment": "example"
}
],
"provider": "example",
"used_by": [
"example"
],
"failure": "example",
"failure_status": 1,
"failure_code": "example",
"errors": [
{
"pointer": "example",
"code": "example",
"detail": "example",
"params": {}
}
]
}

The change conflicts with what exists, such as already_exists for a key already in use.

Media typeapplication/problem+json

A problem document (RFC 9457). Code-specific values are further members.

object
type
required
string
title
required
string
status
required
integer
code
required

Stable snake_case name of the problem, which clients branch on.

string
detail

An English explanation for humans; never what a client branches on.

string
request_id
required
string
retry_after

Seconds to wait before retrying, for a rate limit.

integer
permission

The permission the caller lacks, for forbidden, or the role’s permission the caller lacks, for role_not_allowed.

string
current_version

The version the entity has now, for version_mismatch.

integer format: int64
references

What still names what the write would remove or hide, for in_use.

Array<object>
object
kind
required

What names it, such as flag, segment or experiment.

string
key
required
string
environment
required

The key of the environment it is named in; null when it is named in every environment.

string
nullable
provider

The slug of the auth provider to sign in through instead, for sso_required.

string
used_by

What keeps an auth provider from being deleted, disabled or edited, for provider_in_use, such as identities, enforced domains or only way in (the only enabled provider while local login is disabled).

Array<string>
failure

Why a system the server asked did not answer as needed, for provider_unreachable; for sink_not_ready the failure class of the target’s check, such as connect or status.

string
failure_status

The HTTP status the target answered, for sink_not_ready, when it answered.

integer
failure_code

The target’s own error code, for sink_not_ready, when it speaks one, such as a ClickHouse exception or an S3 error code.

string
errors
Array<object>
object
pointer
required

JSON Pointer into the request body.

string
code
required
string
detail
required
string
params

The values of the rule broken, such as the bounds of a length, for a client to explain the violation in its own language.

object
key
additional properties
any

Example generated

{
"type": "example",
"title": "example",
"status": 1,
"code": "example",
"detail": "example",
"request_id": "example",
"retry_after": 1,
"permission": "example",
"current_version": 1,
"references": [
{
"kind": "example",
"key": "example",
"environment": "example"
}
],
"provider": "example",
"used_by": [
"example"
],
"failure": "example",
"failure_status": 1,
"failure_code": "example",
"errors": [
{
"pointer": "example",
"code": "example",
"detail": "example",
"params": {}
}
]
}

request_too_large: the body is larger than the operation accepts; one that checks a password accepts 8 KiB.

Media typeapplication/problem+json

A problem document (RFC 9457). Code-specific values are further members.

object
type
required
string
title
required
string
status
required
integer
code
required

Stable snake_case name of the problem, which clients branch on.

string
detail

An English explanation for humans; never what a client branches on.

string
request_id
required
string
retry_after

Seconds to wait before retrying, for a rate limit.

integer
permission

The permission the caller lacks, for forbidden, or the role’s permission the caller lacks, for role_not_allowed.

string
current_version

The version the entity has now, for version_mismatch.

integer format: int64
references

What still names what the write would remove or hide, for in_use.

Array<object>
object
kind
required

What names it, such as flag, segment or experiment.

string
key
required
string
environment
required

The key of the environment it is named in; null when it is named in every environment.

string
nullable
provider

The slug of the auth provider to sign in through instead, for sso_required.

string
used_by

What keeps an auth provider from being deleted, disabled or edited, for provider_in_use, such as identities, enforced domains or only way in (the only enabled provider while local login is disabled).

Array<string>
failure

Why a system the server asked did not answer as needed, for provider_unreachable; for sink_not_ready the failure class of the target’s check, such as connect or status.

string
failure_status

The HTTP status the target answered, for sink_not_ready, when it answered.

integer
failure_code

The target’s own error code, for sink_not_ready, when it speaks one, such as a ClickHouse exception or an S3 error code.

string
errors
Array<object>
object
pointer
required

JSON Pointer into the request body.

string
code
required
string
detail
required
string
params

The values of the rule broken, such as the bounds of a length, for a client to explain the violation in its own language.

object
key
additional properties
any

Example generated

{
"type": "example",
"title": "example",
"status": 1,
"code": "example",
"detail": "example",
"request_id": "example",
"retry_after": 1,
"permission": "example",
"current_version": 1,
"references": [
{
"kind": "example",
"key": "example",
"environment": "example"
}
],
"provider": "example",
"used_by": [
"example"
],
"failure": "example",
"failure_status": 1,
"failure_code": "example",
"errors": [
{
"pointer": "example",
"code": "example",
"detail": "example",
"params": {}
}
]
}

unsupported_media_type: the document is not sent as application/json or application/yaml.

Media typeapplication/problem+json

A problem document (RFC 9457). Code-specific values are further members.

object
type
required
string
title
required
string
status
required
integer
code
required

Stable snake_case name of the problem, which clients branch on.

string
detail

An English explanation for humans; never what a client branches on.

string
request_id
required
string
retry_after

Seconds to wait before retrying, for a rate limit.

integer
permission

The permission the caller lacks, for forbidden, or the role’s permission the caller lacks, for role_not_allowed.

string
current_version

The version the entity has now, for version_mismatch.

integer format: int64
references

What still names what the write would remove or hide, for in_use.

Array<object>
object
kind
required

What names it, such as flag, segment or experiment.

string
key
required
string
environment
required

The key of the environment it is named in; null when it is named in every environment.

string
nullable
provider

The slug of the auth provider to sign in through instead, for sso_required.

string
used_by

What keeps an auth provider from being deleted, disabled or edited, for provider_in_use, such as identities, enforced domains or only way in (the only enabled provider while local login is disabled).

Array<string>
failure

Why a system the server asked did not answer as needed, for provider_unreachable; for sink_not_ready the failure class of the target’s check, such as connect or status.

string
failure_status

The HTTP status the target answered, for sink_not_ready, when it answered.

integer
failure_code

The target’s own error code, for sink_not_ready, when it speaks one, such as a ClickHouse exception or an S3 error code.

string
errors
Array<object>
object
pointer
required

JSON Pointer into the request body.

string
code
required
string
detail
required
string
params

The values of the rule broken, such as the bounds of a length, for a client to explain the violation in its own language.

object
key
additional properties
any

Example generated

{
"type": "example",
"title": "example",
"status": 1,
"code": "example",
"detail": "example",
"request_id": "example",
"retry_after": 1,
"permission": "example",
"current_version": 1,
"references": [
{
"kind": "example",
"key": "example",
"environment": "example"
}
],
"provider": "example",
"used_by": [
"example"
],
"failure": "example",
"failure_status": 1,
"failure_code": "example",
"errors": [
{
"pointer": "example",
"code": "example",
"detail": "example",
"params": {}
}
]
}

The request is well formed but breaks a rule; errors names each field to fix.

Media typeapplication/problem+json

A problem document (RFC 9457). Code-specific values are further members.

object
type
required
string
title
required
string
status
required
integer
code
required

Stable snake_case name of the problem, which clients branch on.

string
detail

An English explanation for humans; never what a client branches on.

string
request_id
required
string
retry_after

Seconds to wait before retrying, for a rate limit.

integer
permission

The permission the caller lacks, for forbidden, or the role’s permission the caller lacks, for role_not_allowed.

string
current_version

The version the entity has now, for version_mismatch.

integer format: int64
references

What still names what the write would remove or hide, for in_use.

Array<object>
object
kind
required

What names it, such as flag, segment or experiment.

string
key
required
string
environment
required

The key of the environment it is named in; null when it is named in every environment.

string
nullable
provider

The slug of the auth provider to sign in through instead, for sso_required.

string
used_by

What keeps an auth provider from being deleted, disabled or edited, for provider_in_use, such as identities, enforced domains or only way in (the only enabled provider while local login is disabled).

Array<string>
failure

Why a system the server asked did not answer as needed, for provider_unreachable; for sink_not_ready the failure class of the target’s check, such as connect or status.

string
failure_status

The HTTP status the target answered, for sink_not_ready, when it answered.

integer
failure_code

The target’s own error code, for sink_not_ready, when it speaks one, such as a ClickHouse exception or an S3 error code.

string
errors
Array<object>
object
pointer
required

JSON Pointer into the request body.

string
code
required
string
detail
required
string
params

The values of the rule broken, such as the bounds of a length, for a client to explain the violation in its own language.

object
key
additional properties
any

Example generated

{
"type": "example",
"title": "example",
"status": 1,
"code": "example",
"detail": "example",
"request_id": "example",
"retry_after": 1,
"permission": "example",
"current_version": 1,
"references": [
{
"kind": "example",
"key": "example",
"environment": "example"
}
],
"provider": "example",
"used_by": [
"example"
],
"failure": "example",
"failure_status": 1,
"failure_code": "example",
"errors": [
{
"pointer": "example",
"code": "example",
"detail": "example",
"params": {}
}
]
}