Environments
List Environments
Returns environments visible to the caller. When project_id is set, the result contains project-owned environments plus workspace environments shared with that project. When project_id is omitted, the result contains workspace-owned environments.from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.environments.list()
# Handle response
print(res)
import { Orq } from "@orq-ai/node";
const orq = new Orq({
apiKey: process.env["ORQ_API_KEY"] ?? "",
});
async function run() {
const result = await orq.environments.list();
console.log(result);
}
run();
Show Parameters
Show Parameters
{
"limit": Optional[int],
"starting_after": Optional[str],
"ending_before": Optional[str],
"project_id": Optional[str],
"search": Optional[str],
}
{
limit?: number;
startingAfter?: string;
endingBefore?: string;
projectId?: string;
search?: string;
}
Show Response
Show Response
{
"object": str,
"data": [{
"id": str,
"slug": str,
"display_name": str,
"description": str,
"created_at": str,
"created_by_id": str,
"updated_at": str,
"updated_by_id": str,
"project_id": Optional[str],
"sharing": { # optional
"all_projects": Dict[str, Any], # optional
"selected": { # optional
"project_ids": List[str], # optional
},
"allow_version_pin": Optional[bool],
"allow_fork": Optional[bool],
"auto_grant_new_projects": Optional[bool],
},
}],
"has_more": bool,
}
{
object: string;
data: {
id: string;
slug: string;
displayName: string;
description: string;
createdAt: Date;
createdById: string;
updatedAt: Date;
updatedById: string;
projectId?: string;
sharing?: {
allProjects?: Record<string, unknown>;
selected?: {
projectIds?: string[];
};
allowVersionPin?: boolean;
allowFork?: boolean;
autoGrantNewProjects?: boolean;
};
}[];
hasMore: boolean;
}
Create an Environment
Creates either a project-owned environment or a workspace-owned environment with sharing. Exactly one scope must be provided.from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.environments.create(slug="<value>", display_name="Production", project_id="<project_id>")
# Handle response
print(res)
import { Orq } from "@orq-ai/node";
const orq = new Orq({
apiKey: process.env["ORQ_API_KEY"] ?? "",
});
async function run() {
const result = await orq.environments.create({
slug: "<value>",
displayName: "Production",
projectId: "<project_id>",
});
console.log(result);
}
run();
Show Parameters
Show Parameters
{
"slug": str, # required
"display_name": str, # required
"description": Optional[str],
"project_id": Optional[str],
"sharing": { # optional
"all_projects": Dict[str, Any], # optional
"selected": { # optional
"project_ids": List[str], # optional
},
"allow_version_pin": Optional[bool],
"allow_fork": Optional[bool],
"auto_grant_new_projects": Optional[bool],
},
}
{
slug: string; // required
displayName: string; // required
description?: string;
projectId?: string;
sharing?: {
allProjects?: Record<string, unknown>;
selected?: {
projectIds?: string[];
};
allowVersionPin?: boolean;
allowFork?: boolean;
autoGrantNewProjects?: boolean;
};
}
Show Response
Show Response
{
"environment": {
"id": str,
"slug": str,
"display_name": str,
"description": str,
"created_at": str,
"created_by_id": str,
"updated_at": str,
"updated_by_id": str,
"project_id": Optional[str],
"sharing": { # optional
"all_projects": Dict[str, Any], # optional
"selected": { # optional
"project_ids": List[str], # optional
},
"allow_version_pin": Optional[bool],
"allow_fork": Optional[bool],
"auto_grant_new_projects": Optional[bool],
},
},
}
{
environment: {
id: string;
slug: string;
displayName: string;
description: string;
createdAt: Date;
createdById: string;
updatedAt: Date;
updatedById: string;
projectId?: string;
sharing?: {
allProjects?: Record<string, unknown>;
selected?: {
projectIds?: string[];
};
allowVersionPin?: boolean;
allowFork?: boolean;
autoGrantNewProjects?: boolean;
};
};
}
Retrieve an Environment
Retrieves a visible environment by ID.from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.environments.get(environment_id="<id>")
# Handle response
print(res)
import { Orq } from "@orq-ai/node";
const orq = new Orq({
apiKey: process.env["ORQ_API_KEY"] ?? "",
});
async function run() {
const result = await orq.environments.get({
environmentId: "<id>",
});
console.log(result);
}
run();
Show Parameters
Show Parameters
{
"environment_id": str, # required
}
{
environmentId: string; // required
}
Show Response
Show Response
{
"environment": {
"id": str,
"slug": str,
"display_name": str,
"description": str,
"created_at": str,
"created_by_id": str,
"updated_at": str,
"updated_by_id": str,
"project_id": Optional[str],
"sharing": { # optional
"all_projects": Dict[str, Any], # optional
"selected": { # optional
"project_ids": List[str], # optional
},
"allow_version_pin": Optional[bool],
"allow_fork": Optional[bool],
"auto_grant_new_projects": Optional[bool],
},
},
}
{
environment: {
id: string;
slug: string;
displayName: string;
description: string;
createdAt: Date;
createdById: string;
updatedAt: Date;
updatedById: string;
projectId?: string;
sharing?: {
allProjects?: Record<string, unknown>;
selected?: {
projectIds?: string[];
};
allowVersionPin?: boolean;
allowFork?: boolean;
autoGrantNewProjects?: boolean;
};
};
}
Delete an Environment
Permanently deletes an environment.from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.environments.delete(environment_id="<id>")
# Handle response
print(res)
import { Orq } from "@orq-ai/node";
const orq = new Orq({
apiKey: process.env["ORQ_API_KEY"] ?? "",
});
async function run() {
const result = await orq.environments.delete({
environmentId: "<id>",
});
console.log(result);
}
run();
Show Parameters
Show Parameters
{
"environment_id": str, # required
}
{
environmentId: string; // required
}
Update an Environment
Updates environment metadata. Scope is immutable; sharing may only be updated on workspace-owned environments.from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.environments.update(environment_id="<id>", display_name="Staging")
# Handle response
print(res)
import { Orq } from "@orq-ai/node";
const orq = new Orq({
apiKey: process.env["ORQ_API_KEY"] ?? "",
});
async function run() {
const result = await orq.environments.update({
environmentId: "<id>",
updateEnvironmentRequest: {
displayName: "Staging",
},
});
console.log(result);
}
run();
Show Parameters
Show Parameters
{
"environment_id": str, # required
"display_name": Optional[str],
"description": Optional[str],
"sharing": { # optional
"all_projects": Dict[str, Any], # optional
"selected": { # optional
"project_ids": List[str], # optional
},
"allow_version_pin": Optional[bool],
"allow_fork": Optional[bool],
"auto_grant_new_projects": Optional[bool],
},
}
{
environmentId: string; // required
updateEnvironmentRequest: { // required
displayName?: string;
description?: string;
sharing?: {
allProjects?: Record<string, unknown>;
selected?: {
projectIds?: string[];
};
allowVersionPin?: boolean;
allowFork?: boolean;
autoGrantNewProjects?: boolean;
};
};
}
Show Response
Show Response
{
"environment": {
"id": str,
"slug": str,
"display_name": str,
"description": str,
"created_at": str,
"created_by_id": str,
"updated_at": str,
"updated_by_id": str,
"project_id": Optional[str],
"sharing": { # optional
"all_projects": Dict[str, Any], # optional
"selected": { # optional
"project_ids": List[str], # optional
},
"allow_version_pin": Optional[bool],
"allow_fork": Optional[bool],
"auto_grant_new_projects": Optional[bool],
},
},
}
{
environment: {
id: string;
slug: string;
displayName: string;
description: string;
createdAt: Date;
createdById: string;
updatedAt: Date;
updatedById: string;
projectId?: string;
sharing?: {
allProjects?: Record<string, unknown>;
selected?: {
projectIds?: string[];
};
allowVersionPin?: boolean;
allowFork?: boolean;
autoGrantNewProjects?: boolean;
};
};
}