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-1fe6520d-e540-493e-8f6a-1777b495c254
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": "2e28e87b-4d75-42a9-9fdd-aacc6b02c714"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTIxNCIsImVtYWlsIjoiZW1haWwtMTQ0QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDgwMzg5NTd9.OnNXQWzHc6MkoCzWHE_lGul5BTdUBcEQ11E-7HA8XIg
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": "2e28e87b-4d75-42a9-9fdd-aacc6b02c714"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTIxNCIsImVtYWlsIjoiZW1haWwtMTQ0QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDgwMzg5NTd9.OnNXQWzHc6MkoCzWHE_lGul5BTdUBcEQ11E-7HA8XIg" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "b504b722-829e-4837-9ab2-516b0df7d3b4",
    "url": "/v2/spaces/b504b722-829e-4837-9ab2-516b0df7d3b4",
    "created_at": "2015-11-13T17:02:37Z",
    "updated_at": null
  },
  "entity": {
    "name": "development",
    "organization_guid": "2e28e87b-4d75-42a9-9fdd-aacc6b02c714",
    "space_quota_definition_guid": null,
    "allow_ssh": true,
    "organization_url": "/v2/organizations/2e28e87b-4d75-42a9-9fdd-aacc6b02c714",
    "developers_url": "/v2/spaces/b504b722-829e-4837-9ab2-516b0df7d3b4/developers",
    "managers_url": "/v2/spaces/b504b722-829e-4837-9ab2-516b0df7d3b4/managers",
    "auditors_url": "/v2/spaces/b504b722-829e-4837-9ab2-516b0df7d3b4/auditors",
    "apps_url": "/v2/spaces/b504b722-829e-4837-9ab2-516b0df7d3b4/apps",
    "routes_url": "/v2/spaces/b504b722-829e-4837-9ab2-516b0df7d3b4/routes",
    "domains_url": "/v2/spaces/b504b722-829e-4837-9ab2-516b0df7d3b4/domains",
    "service_instances_url": "/v2/spaces/b504b722-829e-4837-9ab2-516b0df7d3b4/service_instances",
    "app_events_url": "/v2/spaces/b504b722-829e-4837-9ab2-516b0df7d3b4/app_events",
    "events_url": "/v2/spaces/b504b722-829e-4837-9ab2-516b0df7d3b4/events",
    "security_groups_url": "/v2/spaces/b504b722-829e-4837-9ab2-516b0df7d3b4/security_groups"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/spaces/b504b722-829e-4837-9ab2-516b0df7d3b4
X-VCAP-Request-ID: 
Content-Length: 1280
X-Content-Type-Options: nosniff

Audit Records Created By The Request

Audit Record: audit.space.create

Attribute Name Value
id 1
guid ea4f2b2e-321b-47d5-80f3-c8b655a28f34
created_at 2015-11-13 17:02:37 UTC
updated_at
timestamp 2015-11-13 17:02:37 UTC
type audit.space.create
actor uaa-id-214
actor_type user
actee b504b722-829e-4837-9ab2-516b0df7d3b4
actee_type space
metadata
{
  "request": {
    "name": "development",
    "organization_guid": "2e28e87b-4d75-42a9-9fdd-aacc6b02c714",
    "allow_ssh": true
  }
}
space_id
organization_guid 2e28e87b-4d75-42a9-9fdd-aacc6b02c714
space_guid b504b722-829e-4837-9ab2-516b0df7d3b4
actor_name email-144@somedomain.com
actee_name development