Search Storyblok's Documentation
  1. Update a Space

Update a Space

Update a space using the numeric ID.
You can only able to update the properties mentioned here.

https://mapi.storyblok.com/v1/spaces/:space_id

Path Parameters

  • :space_id

    required number

    Numeric ID of a space

Request Body Properties

  • space

    The Space Object
    • name

      string

      Name of the Space

    • domain

      string

      Domain for your default preview url

    • uniq_domain

      string

      Unique Domain for the Storyblok Rendering Service

    • owner_id

      number

      Numeric user id of the owner for that space

    • story_published_hook

      string

      Published Webhook URL

    • environments

      object[]

      Array of name, location (url) objects

    • parent_id

      number

      Space id of a possible parent space

    • searchblok_id

      number

      Searchblok id, if available

    • duplicatable

      boolean

      Is the space globally duplicatable by all users

    • billing_address

      object

      Billing information used to generate your invoices for this space

    • routes

      string[]

      Routes for the Storyblok Rendering Service

    • default_root

      string

      Component name which will be used as default content type for this folders entries

    • has_pending_tasks

      boolean

      If the space has pending tasks like backup, deployment etc

    • options

      object

      Options for backup and language configurations

Response Properties

  • space

    The Space Object
    • name

      string

      Name of the Space

    • domain

      string

      Domain for your default preview url

    • uniq_domain

      string

      Unique Domain for the Storyblok Rendering Service

    • plan

      string

      Space Plan

    • plan_level

      number

      Plan Level of Space

    • limits

      object

      Limits of the space

    • created_at

      string

      Creation date (Format: yyyy-MM-dd'T'HH:mm:ssZ)

    • id

      number

      ID of the space

    • role

      string

      Role of the collaborator, could be admin, editor or custom roles

    • owner_id

      number

      Numeric user id of the owner for that space

    • story_published_hook

      string

      Published Webhook URL

    • environments

      object[]

      Array of name, location (url) objects

    • stories_count

      number

      Number of Stories in the Space

    • parent_id

      number

      Space id of a possible parent space

    • assets_count

      number

      Number of Assets in the Space

    • searchblok_id

      number

      Searchblok id, if available

    • duplicatable

      boolean

      Is the space globally duplicatable by all users

    • request_count_today

      number

      Request Count of the day

    • exceeded_requests

      number

      Number of Exceeded Requests

    • billing_address

      object

      Billing information used to generate your invoices for this space

    • routes

      string[]

      Routes for the Storyblok Rendering Service

    • trial

      boolean

      Is the space in trial mode

    • default_root

      string

      Component name which will be used as default content type for this folders entries

    • has_slack_webhook

      boolean

      Does the space have a slack webhook

    • has_pending_tasks

      boolean

      If the space has pending tasks like backup, deployment etc

    • first_token

      string

      The oldest available preview token of the space

    • options

      object

      Options for backup and language configurations

    • collaborator

      The Collaborator Object

      Array of Collaborators of the Space

      • user

        object

        The user object inside a collaborator object

      • role

        string

        Role of the collaborator, could be admin, editor or custom roles

      • user_id

        number

        Numeric ID of the user

      • permissions

        enum[]

        Allow specific actions for collaborator in interface and add the permission as array of strings

        PermissionDescription
        publish_storiesAllow publishing of content entries
        save_storiesAllow editing and saving of content entries
        edit_datasourcesAllow editing and saving of datasources
        access_commerceAllow access to commerce app
        edit_story_slugDeny the change of slugs of content entries
        move_storyDeny moving of content entries
        view_composerDeny 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

        number

        Numeric id of collaborator

      • space_role_id

        number

        Numeric ID of the space role

      • space_role_ids

        number[]

        Array of space role ids

      • space_id

        number

        Numeric id of the collaborator space

    • owner

      object

      The user Object of the Owner

Request
curl "https://mapi.storyblok.com/v1/spaces/12422" \ 
  -X PUT \
  -H "Authorization: YOUR_OAUTH_TOKEN" \
  -H "Content-Type: application/json" \
  -d "{\"space\": {\"id\": 12422,\"name\": \"Updated Example Space\"}}"
Request
// Using the Universal JavaScript Client:
// https://github.com/storyblok/storyblok-js-client
Storyblok.put('/spaces/12422', {
  "space": {
    "id": 12422,
    "name": "Updated Example Space"
  }
})
  .then(response => {
    console.log(response)
  }).catch(error => { 
    console.log(error)
  })
Request
$client = new \Storyblok\ManagementClient('YOUR_OAUTH_TOKEN');

$payload = [
  "space" =>  [
    "id" =>  12422,
    "name" =>  "Updated Example Space"
  ]
];

$client->put('/spaces/12422', $payload)->getBody();
Request
require 'storyblok'
client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')

payload = {
  "space" =>  {
    "id" =>  12422,
    "name" =>  "Updated Example Space"
  }
}

client.put('/spaces/12422', payload)
Request
HttpResponse<String> response = Unirest.put("https://mapi.storyblok.com/v1/spaces/12422")
  .header("Content-Type", "application/json")
  .header("Authorization", "YOUR_OAUTH_TOKEN")
  .body("{\"space\": {\"id\": 12422,\"name\": \"Updated Example Space\"}}")
  .asString();
Request
var client = new RestClient("https://mapi.storyblok.com/v1/spaces/12422");
var request = new RestRequest(Method.PUT);

request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "YOUR_OAUTH_TOKEN");
request.AddParameter("application/json", "{\"space\": {\"id\": 12422,\"name\": \"Updated Example Space\"}}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Request
import Foundation

let headers = [
  "Content-Type": "application/json",
  "Authorization": "YOUR_OAUTH_TOKEN"
]

let postData = NSData(data: "{\"space\": {\"id\": 12422,\"name\": \"Updated Example Space\"}}".data(using: String.Encoding.utf8)!)

let request = NSMutableURLRequest(url: NSURL(string: "https://mapi.storyblok.com/v1/spaces/12422")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0)
request.method = "PUT"
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()
Request
import requests

url = "https://mapi.storyblok.com/v1/spaces/12422"

querystring = {}

payload = "{\"space\": {\"id\": 12422,\"name\": \"Updated Example Space\"}}"
headers = {
  'Content-Type': "application/json",
  'Authorization': "YOUR_OAUTH_TOKEN"
}

response = requests.request("PUT", url, data=payload, headers=headers, params=querystring)

print(response.text)