Create a Space
This endpoint creates a new space.
https://mapi.storyblok.com/v1/spaces/
Request Body Properties
-
space
The Space ObjectThe space object
-
name
required stringName of the Space
-
domain
stringDomain for your default preview url
-
story_published_hook
stringPublished Webhook URL
-
environments
object[]Array of name, location (url) objects
-
searchblok_id
numberSearchblok id, if available
-
has_pending_tasks
booleanIf the space has pending tasks like backup, deployment etc
-
Response Properties
-
space
The Space ObjectThe space object
-
name
stringName of the Space
-
domain
stringDomain for your default preview url
-
uniq_domain
stringUnique Domain for the Storyblok Rendering Service
-
plan
stringSpace Plan
-
plan_level
numberPlan Level of Space
-
limits
objectLimits of the space
-
created_at
stringCreation date (Format:
yyyy-MM-dd'T'HH:mm:ssZ
) -
id
numberID of the space
-
role
stringRole of the collaborator, could be admin, editor or custom roles
-
owner_id
numberNumeric user id of the owner for that space
-
story_published_hook
stringPublished Webhook URL
-
environments
object[]Array of name, location (url) objects
-
stories_count
numberNumber of Stories in the Space
-
parent_id
numberSpace id of a possible parent space
-
assets_count
numberNumber of Assets in the Space
-
searchblok_id
numberSearchblok id, if available
-
duplicatable
booleanIs the space globally duplicatable by all users
-
request_count_today
numberRequest Count of the day
-
exceeded_requests
numberNumber of Exceeded Requests
-
billing_address
objectBilling information used to generate your invoices for this space
-
routes
string[]Routes for the Storyblok Rendering Service
-
trial
booleanIs the space in trial mode
-
default_root
stringComponent name which will be used as default content type for this folders entries
-
has_slack_webhook
booleanDoes the space have a slack webhook
-
has_pending_tasks
booleanIf the space has pending tasks like backup, deployment etc
-
first_token
stringThe oldest available preview token of the space
-
options
objectOptions for backup and language configurations
-
collaborator
The Collaborator ObjectArray of Collaborators of the Space
-
user
objectThe user object inside a collaborator object
-
role
stringRole of the collaborator, could be admin, editor or custom roles
-
user_id
numberNumeric ID of the user
-
permissions
enum[]Allow specific actions for collaborator in interface and add the permission as array of strings
Permission Description publish_stories Allow publishing of content entries save_stories Allow editing and saving of content entries edit_datasources Allow editing and saving of datasources access_commerce Allow access to commerce app edit_story_slug Deny the change of slugs of content entries move_story Deny moving of content entries view_composer Deny access to visual composer -
allowed_paths
number[]Story ids the user should have access to (acts as whitelist). If no item is selected the user has rights to access all content items.
-
field_permissions
string[]Hide specific fields for this user with an array of strings with the schema
-
id
Numeric id of collaborator
-
space_role_id
numberNumeric ID of the space role
-
space_role_ids
number[]Array of space role ids
-
space_id
numberNumeric id of the collaborator space
-
-
owner
objectThe user Object of the Owner
-
curl "https://mapi.storyblok.com/v1/spaces/" \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: YOUR_OAUTH_TOKEN" \
-d "{\"space\": {\"name\": \"Example Space\"}}"
// Using the Universal JavaScript Client:
// https://github.com/storyblok/storyblok-js-client
Storyblok.post('/spaces/', {
"space": {
"name": "Example Space"
}
})
.then(response => {
console.log(response)
}).catch(error => {
console.log(error)
})
$client = new \Storyblok\ManagementClient('YOUR_OAUTH_TOKEN');
$payload = [
"space" => [
"name" => "Example Space"
]
];
$client->post('/spaces/', $payload)->getBody();
require 'storyblok'
client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')
payload = {
"space" => {
"name" => "Example Space"
}
}
client.post('/spaces/', payload)
HttpResponse<String> response = Unirest.post("https://mapi.storyblok.com/v1/spaces/")
.header("Content-Type", "application/json")
.header("Authorization", "YOUR_OAUTH_TOKEN")
.body("{\"space\": {\"name\": \"Example Space\"}}")
.asString();
var client = new RestClient("https://mapi.storyblok.com/v1/spaces/");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "YOUR_OAUTH_TOKEN");
request.AddParameter("application/json", "{\"space\": {\"name\": \"Example Space\"}}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import Foundation
let headers = [
"Content-Type": "application/json",
"Authorization": "YOUR_OAUTH_TOKEN"
]
let postData = NSData(data: "{\"space\": {\"name\": \"Example Space\"}}".data(using: String.Encoding.utf8)!)
let request = NSMutableURLRequest(url: NSURL(string: "https://mapi.storyblok.com/v1/spaces/")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0)
request.method = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
import requests
url = "https://mapi.storyblok.com/v1/spaces/"
querystring = {}
payload = "{\"space\": {\"name\": \"Example Space\"}}"
headers = {
'Content-Type': "application/json",
'Authorization': "YOUR_OAUTH_TOKEN"
}
response = requests.request("POST", url, data=payload, headers=headers, params=querystring)
print(response.text)