> ## Documentation Index
> Fetch the complete documentation index at: https://developers.projectcor.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Workspace

> Creates a new workspace in your COR instance with external ID mapping

Creates a new workspace in your COR instance through the integrations service. Validates workspace name, ID, and active status before creating.

## Request Body Requirements

<ParamField body="metadata" type="object" required>
  <Expandable title="properties">
    <ParamField body="source" type="string" required>
      Integration source identifier
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="id" type="string" required>
  External workspace ID from your source system
</ParamField>

<ParamField body="name" type="string" required>
  Workspace name
</ParamField>

<ParamField body="active" type="boolean">
  Whether the workspace is active (default: true)
</ParamField>

<ParamField body="description" type="string">
  Workspace description
</ParamField>

## Known Errors

* `ValidationError` — Missing required fields
* `DuplicateExternalIdError` — A workspace with this external ID already exists

<RequestExample>
  ```bash cURL theme={null}
  curl --location 'https://integrations.projectcor.com/v2/integrations/workspaces' \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "metadata": {
      "source": "MICROSOFT_TEAMS"
    },
    "id": "TEAMS-WS-12345",
    "name": "Marketing Team",
    "active": true,
    "description": "Workspace for the marketing department"
  }'
  ```

  ```python Python theme={null}
  import requests

  url = "https://integrations.projectcor.com/v2/integrations/workspaces"

  payload = {
      "metadata": {
          "source": "MICROSOFT_TEAMS"
      },
      "id": "TEAMS-WS-12345",
      "name": "Marketing Team",
      "active": True,
      "description": "Workspace for the marketing department"
  }

  headers = {
      "Authorization": "Bearer YOUR_ACCESS_TOKEN",
      "Content-Type": "application/json"
  }

  response = requests.post(url, json=payload, headers=headers)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://integrations.projectcor.com/v2/integrations/workspaces',
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        metadata: {
          source: 'MICROSOFT_TEAMS'
        },
        id: 'TEAMS-WS-12345',
        name: 'Marketing Team',
        active: true,
        description: 'Workspace for the marketing department'
      })
    }
  );

  const data = await response.json();
  console.log(data);
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": 5001,
    "name": "Marketing Team",
    "active": true,
    "description": "Workspace for the marketing department",
    "company_id": 1234,
    "created_at": "2025-01-10T14:30:00Z",
    "updated_at": "2025-01-10T14:30:00Z"
  }
  ```

  ```json 400 theme={null}
  {
    "error": "ValidationError",
    "message": "Missing required field: name",
    "code": "ZC002"
  }
  ```
</ResponseExample>
