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

# Create Workspace

Use this API to programmatically create a new Velt workspace. Protected by IP-based rate limiting and disposable email domain blocking.

<Info>
  This is a **public endpoint** — no authentication headers are required.
</Info>

# Endpoint

`POST https://api.velt.dev/v2/workspace/create`

# Body

#### Params

<ParamField body="data" type="object" required>
  <Expandable title="properties">
    <ParamField body="ownerEmail" type="string" required>
      Email address of the workspace owner. Disposable email domains are blocked.
    </ParamField>

    <ParamField body="name" type="string">
      Owner's display name. Max 200 characters.
    </ParamField>

    <ParamField body="workspaceName" type="string">
      Workspace name. Max 200 characters. Defaults to `"{name} workspace"` when not provided.
    </ParamField>

    <ParamField body="avatar" type="string">
      URL for the workspace avatar image. Max 2000 characters.
    </ParamField>
  </Expandable>
</ParamField>

# Example Request

```JSON theme={null}
{
  "data": {
    "ownerEmail": "owner@example.com",
    "name": "John Doe",
    "workspaceName": "My Workspace",
    "avatar": "https://example.com/avatar.png"
  }
}
```

# Example Response

#### Success Response

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "Workspace created successfully.",
    "data": {
      "id": "workspace_abc123",
      "name": "My Workspace",
      "owner": {
        "email": "owner@example.com",
        "id": "owner_id_123",
        "name": "John Doe",
        "avatar": ""
      },
      "authToken": "eyJhbGciOiJSUzI1NiIs...",
      "apiKeyList": {
        "velt_api_key_1": {
          "apiKeyName": "John Doe Test API Key",
          "id": "velt_api_key_1",
          "type": "testing"
        }
      }
    }
  }
}
```

<Note>
  `apiKeyList` is a **keyed object** (not an array). Each key is the API key ID. To extract the first API key, use `Object.keys(result.data.apiKeyList)[0]` in JavaScript or iterate over the object keys.
</Note>

#### Failure Response

##### If email domain is disposable

```JSON theme={null}
{
  "error": {
    "status": "INVALID_ARGUMENT",
    "message": "Disposable email domains are not allowed."
  }
}
```

##### If rate limit exceeded

```JSON theme={null}
{
  "error": {
    "status": "RESOURCE_EXHAUSTED",
    "message": "Too many requests. Please try again later."
  }
}
```

# Next Steps

After creating a workspace, use the response values for subsequent API calls:

* **Workspace-level endpoints** (e.g., [Get Workspace](/api-reference/rest-apis/v2/workspace/get), [Create API Key](/api-reference/rest-apis/v2/workspace/apikey-create)): pass `result.data.id` as the `x-velt-workspace-id` header and `result.data.authToken` as the `x-velt-auth-token` header.
* **API-key-level endpoints** (e.g., [Add Domains](/api-reference/rest-apis/v2/workspace/add-domain), [Update Email Config](/api-reference/rest-apis/v2/workspace/emailconfig-update)): extract the API key ID from `Object.keys(result.data.apiKeyList)[0]`, then retrieve its auth token via [Get Auth Tokens](/api-reference/rest-apis/v2/workspace/authtokens-get). Pass these as `x-velt-api-key` and `x-velt-auth-token`.

<ResponseExample>
  ```js theme={null}
  {
    "result": {
      "status": "success",
      "message": "Workspace created successfully.",
      "data": {
        "id": "workspace_abc123",
        "name": "My Workspace",
        "owner": {
          "email": "owner@example.com",
          "id": "owner_id_123",
          "name": "John Doe",
          "avatar": ""
        },
        "authToken": "eyJhbGciOiJSUzI1NiIs...",
        "apiKeyList": {
          "velt_api_key_1": {
            "apiKeyName": "John Doe Test API Key",
            "id": "velt_api_key_1",
            "type": "testing"
          }
        }
      }
    }
  }
  ```
</ResponseExample>
