Home
Version 3
Spaces API

Spaces API

Creating a Space

POST /v2/spaces/

Request

Route

POST /v2/spaces

Body

Name Description Default Valid Values Example Values
name The name of the space
  • development
  • demo
  • production
organization_guid The guid of the associated organization
  • guid-a5f34b2a-ffd2-4ce5-92de-ab7ea789ddb7
developer_guids The list of the associated developers
manager_guids The list of the associated managers
auditor_guids The list of the associated auditors
domain_guids The list of the associated domains
security_group_guids The list of the associated security groups
space_quota_definition_guid The guid of the associated space quota definition
allow_ssh Whether or not Space Developers can enable ssh on apps in the space
{
  "name": "development",
  "organization_guid": "067341a0-8fbd-4cf9-9577-5d37800b61c5"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTE3MiIsImVtYWlsIjoiZW1haWwtMTEwQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MzM5ODExMDZ9.yUzTwX8HBxYO32Gpq2kzXREcOo64MBI2bgEaIq_7VFI
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

cURL

curl "https://api.[your-domain.com]/v2/spaces" -d '{
  "name": "development",
  "organization_guid": "067341a0-8fbd-4cf9-9577-5d37800b61c5"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTE3MiIsImVtYWlsIjoiZW1haWwtMTEwQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MzM5ODExMDZ9.yUzTwX8HBxYO32Gpq2kzXREcOo64MBI2bgEaIq_7VFI" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "05657643-094d-407e-ba51-95d47ec0b519",
    "url": "/v2/spaces/05657643-094d-407e-ba51-95d47ec0b519",
    "created_at": "2015-06-04T00:05:06Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "067341a0-8fbd-4cf9-9577-5d37800b61c5",
    "space_quota_definition_guid": null,
    "allow_ssh": true,
    "organization_url": "/v2/organizations/067341a0-8fbd-4cf9-9577-5d37800b61c5",
    "developers_url": "/v2/spaces/05657643-094d-407e-ba51-95d47ec0b519/developers",
    "managers_url": "/v2/spaces/05657643-094d-407e-ba51-95d47ec0b519/managers",
    "auditors_url": "/v2/spaces/05657643-094d-407e-ba51-95d47ec0b519/auditors",
    "apps_url": "/v2/spaces/05657643-094d-407e-ba51-95d47ec0b519/apps",
    "routes_url": "/v2/spaces/05657643-094d-407e-ba51-95d47ec0b519/routes",
    "domains_url": "/v2/spaces/05657643-094d-407e-ba51-95d47ec0b519/domains",
    "service_instances_url": "/v2/spaces/05657643-094d-407e-ba51-95d47ec0b519/service_instances",
    "app_events_url": "/v2/spaces/05657643-094d-407e-ba51-95d47ec0b519/app_events",
    "events_url": "/v2/spaces/05657643-094d-407e-ba51-95d47ec0b519/events",
    "security_groups_url": "/v2/spaces/05657643-094d-407e-ba51-95d47ec0b519/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/05657643-094d-407e-ba51-95d47ec0b519
X-VCAP-Request-ID: e4d807b2-f708-412d-a6c8-bba99414abce
Content-Length: 1280
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 4
guid eb84fd1c-be8a-4bb9-b192-0b7957274fa5
created_at 2015-06-04 00:05:06 UTC
updated_at
timestamp 2015-06-04 00:05:06 UTC
type audit.space.create
actor uaa-id-172
actor_type user
actee 05657643-094d-407e-ba51-95d47ec0b519
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "067341a0-8fbd-4cf9-9577-5d37800b61c5",
    "allow_ssh": true
  }
}
space_id 3
organization_guid 067341a0-8fbd-4cf9-9577-5d37800b61c5
space_guid 05657643-094d-407e-ba51-95d47ec0b519
actor_name email-110@somedomain.com
actee_name development