Create a project from a project document
const url = 'https://example.com/api/v1/projects/import?dry_run=false';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '"binary"'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”The new project’s key, replacing the document’s.
The new project’s name, replacing the document’s.
Run the whole import and roll it back, answering what it would have done.
Request Bodyrequired
Section titled “Request Bodyrequired”A ProjectDocument as JSON.
Example generated
binaryA ProjectDocument as YAML.
Responses
Section titled “Responses”The project the document would create, for a dry run.
What an import did, or with a dry run what it would do.
object
object
The keys of the entities an import created, updated and deleted, by kind. Standard attributes are never in it.
object
object
object
An RFC 6902 JSON Patch turning the entity as it was into the entity as it is, over its entry of the document.
object
object
object
An RFC 6902 JSON Patch turning the entity as it was into the entity as it is, over its entry of the document.
object
object
object
An RFC 6902 JSON Patch turning the entity as it was into the entity as it is, over its entry of the document.
object
object
object
An RFC 6902 JSON Patch turning the entity as it was into the entity as it is, over its entry of the document.
object
object
object
An RFC 6902 JSON Patch turning the entity as it was into the entity as it is, over its entry of the document.
object
object
object
An RFC 6902 JSON Patch turning the entity as it was into the entity as it is, over its entry of the document.
object
Something an import did differently from what the document asks, or could not do, without refusing it.
object
Stable name of the warning, such as owner_replaced.
A JSON Pointer into the document, empty for the document as a whole.
The values a client explains the warning with, such as the email of an owner replaced.
object
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.
What an import did, or with a dry run what it would do.
object
object
The keys of the entities an import created, updated and deleted, by kind. Standard attributes are never in it.
object
object
object
An RFC 6902 JSON Patch turning the entity as it was into the entity as it is, over its entry of the document.
object
object
object
An RFC 6902 JSON Patch turning the entity as it was into the entity as it is, over its entry of the document.
object
object
object
An RFC 6902 JSON Patch turning the entity as it was into the entity as it is, over its entry of the document.
object
object
object
An RFC 6902 JSON Patch turning the entity as it was into the entity as it is, over its entry of the document.
object
object
object
An RFC 6902 JSON Patch turning the entity as it was into the entity as it is, over its entry of the document.
object
object
object
An RFC 6902 JSON Patch turning the entity as it was into the entity as it is, over its entry of the document.
object
Something an import did differently from what the document asks, or could not do, without refusing it.
object
Stable name of the warning, such as owner_replaced.
A JSON Pointer into the document, empty for the document as a whole.
The values a client explains the warning with, such as the email of an owner replaced.
object
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.
A problem document (RFC 9457). Code-specific values are further members.
object
Stable snake_case name of the problem, which clients branch on.
An English explanation for humans; never what a client branches on.
Seconds to wait before retrying, for a rate limit.
The permission the caller lacks, for forbidden, or the role’s permission the caller lacks, for role_not_allowed.
The version the entity has now, for version_mismatch.
What still names what the write would remove or hide, for in_use.
object
What names it, such as flag, segment or experiment.
The key of the environment it is named in; null when it is named in every environment.
The slug of the auth provider to sign in through instead, for sso_required.
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).
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.
The HTTP status the target answered, for sink_not_ready, when it answered.
The target’s own error code, for sink_not_ready, when it speaks one, such as a ClickHouse exception or an S3 error code.
object
JSON Pointer into the request body.
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
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.
A problem document (RFC 9457). Code-specific values are further members.
object
Stable snake_case name of the problem, which clients branch on.
An English explanation for humans; never what a client branches on.
Seconds to wait before retrying, for a rate limit.
The permission the caller lacks, for forbidden, or the role’s permission the caller lacks, for role_not_allowed.
The version the entity has now, for version_mismatch.
What still names what the write would remove or hide, for in_use.
object
What names it, such as flag, segment or experiment.
The key of the environment it is named in; null when it is named in every environment.
The slug of the auth provider to sign in through instead, for sso_required.
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).
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.
The HTTP status the target answered, for sink_not_ready, when it answered.
The target’s own error code, for sink_not_ready, when it speaks one, such as a ClickHouse exception or an S3 error code.
object
JSON Pointer into the request body.
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
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": {} } ]}Headers
Section titled “Headers”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.
A problem document (RFC 9457). Code-specific values are further members.
object
Stable snake_case name of the problem, which clients branch on.
An English explanation for humans; never what a client branches on.
Seconds to wait before retrying, for a rate limit.
The permission the caller lacks, for forbidden, or the role’s permission the caller lacks, for role_not_allowed.
The version the entity has now, for version_mismatch.
What still names what the write would remove or hide, for in_use.
object
What names it, such as flag, segment or experiment.
The key of the environment it is named in; null when it is named in every environment.
The slug of the auth provider to sign in through instead, for sso_required.
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).
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.
The HTTP status the target answered, for sink_not_ready, when it answered.
The target’s own error code, for sink_not_ready, when it speaks one, such as a ClickHouse exception or an S3 error code.
object
JSON Pointer into the request body.
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
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.
A problem document (RFC 9457). Code-specific values are further members.
object
Stable snake_case name of the problem, which clients branch on.
An English explanation for humans; never what a client branches on.
Seconds to wait before retrying, for a rate limit.
The permission the caller lacks, for forbidden, or the role’s permission the caller lacks, for role_not_allowed.
The version the entity has now, for version_mismatch.
What still names what the write would remove or hide, for in_use.
object
What names it, such as flag, segment or experiment.
The key of the environment it is named in; null when it is named in every environment.
The slug of the auth provider to sign in through instead, for sso_required.
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).
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.
The HTTP status the target answered, for sink_not_ready, when it answered.
The target’s own error code, for sink_not_ready, when it speaks one, such as a ClickHouse exception or an S3 error code.
object
JSON Pointer into the request body.
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
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.
A problem document (RFC 9457). Code-specific values are further members.
object
Stable snake_case name of the problem, which clients branch on.
An English explanation for humans; never what a client branches on.
Seconds to wait before retrying, for a rate limit.
The permission the caller lacks, for forbidden, or the role’s permission the caller lacks, for role_not_allowed.
The version the entity has now, for version_mismatch.
What still names what the write would remove or hide, for in_use.
object
What names it, such as flag, segment or experiment.
The key of the environment it is named in; null when it is named in every environment.
The slug of the auth provider to sign in through instead, for sso_required.
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).
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.
The HTTP status the target answered, for sink_not_ready, when it answered.
The target’s own error code, for sink_not_ready, when it speaks one, such as a ClickHouse exception or an S3 error code.
object
JSON Pointer into the request body.
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
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.
A problem document (RFC 9457). Code-specific values are further members.
object
Stable snake_case name of the problem, which clients branch on.
An English explanation for humans; never what a client branches on.
Seconds to wait before retrying, for a rate limit.
The permission the caller lacks, for forbidden, or the role’s permission the caller lacks, for role_not_allowed.
The version the entity has now, for version_mismatch.
What still names what the write would remove or hide, for in_use.
object
What names it, such as flag, segment or experiment.
The key of the environment it is named in; null when it is named in every environment.
The slug of the auth provider to sign in through instead, for sso_required.
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).
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.
The HTTP status the target answered, for sink_not_ready, when it answered.
The target’s own error code, for sink_not_ready, when it speaks one, such as a ClickHouse exception or an S3 error code.
object
JSON Pointer into the request body.
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
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.
A problem document (RFC 9457). Code-specific values are further members.
object
Stable snake_case name of the problem, which clients branch on.
An English explanation for humans; never what a client branches on.
Seconds to wait before retrying, for a rate limit.
The permission the caller lacks, for forbidden, or the role’s permission the caller lacks, for role_not_allowed.
The version the entity has now, for version_mismatch.
What still names what the write would remove or hide, for in_use.
object
What names it, such as flag, segment or experiment.
The key of the environment it is named in; null when it is named in every environment.
The slug of the auth provider to sign in through instead, for sso_required.
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).
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.
The HTTP status the target answered, for sink_not_ready, when it answered.
The target’s own error code, for sink_not_ready, when it speaks one, such as a ClickHouse exception or an S3 error code.
object
JSON Pointer into the request body.
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
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": {} } ]}