Crea ambiente
POST/v1/environments
Crea un nuovo ambiente con la configurazione specificata.
Parameters
Returns
Crea ambiente
<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
$client = new Client(apiKey: 'my-anthropic-api-key');
$betaEnvironment = $client->beta->environments->create(
name: 'python-data-analysis',
config: [
'type' => 'cloud',
'networking' => [
'type' => 'limited',
'allowMCPServers' => true,
'allowPackageManagers' => true,
'allowedHosts' => ['api.example.com'],
],
'packages' => [
'apt' => ['string'],
'cargo' => ['string'],
'gem' => ['string'],
'go' => ['string'],
'npm' => ['string'],
'pip' => ['pandas', 'numpy'],
'type' => 'packages',
],
],
description: 'Python environment with data-analysis packages.',
metadata: ['foo' => 'string'],
scope: 'organization',
betas: [AnthropicBeta::MESSAGE_BATCHES_2024_09_24],
workspaceID: 'wrkspc_011CZkZaBF1tNoB5wlCeusgy',
);
var_dump($betaEnvironment);Response 200
{
"id": "env_011CZkZ9X2dpNyB7HsEFoRfW",
"archived_at": null,
"config": {
"networking": {
"allow_mcp_servers": false,
"allow_package_managers": true,
"allowed_hosts": [
"api.example.com"
],
"type": "limited"
},
"packages": {
"apt": [
"string"
],
"cargo": [
"string"
],
"gem": [
"string"
],
"go": [
"string"
],
"npm": [
"string"
],
"pip": [
"pandas",
"numpy"
],
"type": "packages"
},
"type": "cloud"
},
"created_at": "2026-03-15T10:00:00Z",
"description": "Python environment with data-analysis packages.",
"metadata": {},
"name": "python-data-analysis",
"type": "environment",
"updated_at": "2026-03-15T10:00:00Z",
"scope": "organization"
}Returns Examples
Response 200
{
"id": "env_011CZkZ9X2dpNyB7HsEFoRfW",
"archived_at": null,
"config": {
"networking": {
"allow_mcp_servers": false,
"allow_package_managers": true,
"allowed_hosts": [
"api.example.com"
],
"type": "limited"
},
"packages": {
"apt": [
"string"
],
"cargo": [
"string"
],
"gem": [
"string"
],
"go": [
"string"
],
"npm": [
"string"
],
"pip": [
"pandas",
"numpy"
],
"type": "packages"
},
"type": "cloud"
},
"created_at": "2026-03-15T10:00:00Z",
"description": "Python environment with data-analysis packages.",
"metadata": {},
"name": "python-data-analysis",
"type": "environment",
"updated_at": "2026-03-15T10:00:00Z",
"scope": "organization"
}