> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://contentful.com/developers/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://contentful.com/developers/docs/_mcp/server.

# Get a space

GET https://cdn.contentful.com/spaces/{space_id}

Each space has a name, a set of locales, and metadata about the space.

Reference: https://contentful.com/developers/docs/references/content-delivery-api/spaces/get-a-space

## Request

### Path parameters

- `space_id` (string, required) — Alphanumeric id of the space to retrieve.

### Query parameters

- `access_token` (string, required) — A *production* Content Delivery API key.

## Response

### 200

OK - Request successful

- `map from string to any`

## Examples

**Response**

```json
{
  "locales": [
    {
      "code": "en-US",
      "default": true,
      "fallbackCode": null,
      "name": "U.S. English"
    }
  ],
  "name": "Documentation examples",
  "sys": {
    "id": "71rop70dkqaj",
    "type": "Space"
  }
}
```

**SDK Code**

```android Android
// Create the Contentful client.
final CDAClient client =
    CDAClient
        .builder()
        .setToken("<access_token>")
        .setSpace("<space_id>")
        .setEnvironment("<environment_id>")
        .build();

client
    .observeSpace()
    // Execute result handling on the `main thread`.
    .observeOn(AndroidSchedulers.mainThread())
    // Networking should happen on io thread.
    .subscribeOn(io.reactivex.schedulers.Schedulers.io())
    .subscribe(
        new DisposableSubscriber<CDASpace>() {
          CDASpace result;

          @Override public void onComplete() {
            // Do something with the result space.
            new AlertDialog.Builder(context)
                .setTitle("Contentful")
                .setMessage("Space: "
                    + (result == null ? "<null>" : result.toString()))
                .show();
          }

          @Override public void onError(Throwable e) {
            // Handle error case.
            new AlertDialog.Builder(context)
                .setTitle("Contentful")
                .setMessage("An error occurred: " + e.toString())
                .show();
          }

          @Override public void onNext(CDASpace space) {
            // Array received, maybe more to come.
            result = space;
          }
        }
    );
```

```java Java
// Create the Contentful client.
final CDAClient client =
    CDAClient
        .builder()
        .setToken("<access_token>") // required
        .setSpace("<space_id>") // required
        .setEnvironment("<environment_id>") // optional, defaults to `master`
        .build();

final CDASpace one =
    client
        .fetchSpace();
```

```kotlin Kotlin
// Create the Contentful client.
val client = CDAClient
        .builder()
        .setToken("<access_token>") // required
        .setSpace("<space_id>") // required
        .setEnvironment("<environment_id>") // optional, defaults to `master`
        .build()

val one = client
        .fetchSpace()
```

```swift Swift
import Contentful

// Retain the client as a property on a type you define so that 
// the client's asynchronous network callbacks are executed.
let client = Client(spaceId: "<space_id>",
                    environmentId: "<environment_id>", // Defaults to "master" if omitted
                    accessToken: "<access_token>")

client.fetchSpace() { (result: Result<Space>) in
  switch result {
    case .success(let space):
      print(space)
    case .error(let error):
      print(error)
  }
}
```

```javascript JavaScript
import { createClient } from 'contentful-management'

const client = createClient({
  space: '<space_id>',
  environment: '<environment_id>', // defaults to 'master' if not set
  accessToken: '<content_delivery_api_key>'
})

client.getSpace()
.then((space) => console.log(space))
.catch(console.error)
```

```php PHP
// contentful.php 3.0

$client = new Contentful\Delivery\Client(
  '<content_delivery_api_key>',
  '<space_id>',
  '<environment_id>' // Defaults to "master" if ommitted
);

$space = $client->getSpace();
```

```ruby Ruby
require 'contentful'

client = Contentful::Client.new(
  space: '<space_id>',
  access_token: '<content_delivery_api_key>',
  environment: 'master',  # Optional - defaults to 'master'.
  dynamic_entries: :auto  # Enables Content Type caching.
)

space = client.space
```

```python Python
from contentful import Client

client = Client(
  '<space_id>',
  '<content_delivery_api_key>',
  environment='master'  # Optional - it defaults to 'master'.
)

space = client.space()
```

```.net .NET
// This client should only be created once per application.
var httpClient = new HttpClient();

var client = new ContentfulClient(httpClient, "<content_delivery_api_key>", "<content_preview_api_key>", "<space_id>");

var space = await client.GetSpace();
```