---
title: "Copy an artifact into a space"
---

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

# Copy an artifact into a space

Path: CloudRaker Workspace API › Workspace Sessions

`POST /workspace/sessions/{sessionId}/artifacts/{artifactId}/commit`

## Authentication

- `bearerAuth`, http, header `Authorization`

## Path parameters

- `sessionId` (`commitWorkspaceArtifact.path.sessionId`; string, required)
- `artifactId` (`commitWorkspaceArtifact.path.artifactId`; string, required)

## Request body

_Required._

- `spaceId` (`commitWorkspaceArtifact.spaceId`; string, required)
  - minLength 1; maxLength 128
- `name` (`commitWorkspaceArtifact.name`; string, optional)
  - minLength 1; maxLength 255

## Example request

```json
{
  "spaceId": "string",
  "name": "string"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.cloudraker.com/workspace/sessions/<sessionId>/artifacts/<artifactId>/commit' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "spaceId": "string",
  "name": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/workspace/sessions/<sessionId>/artifacts/<artifactId>/commit';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({spaceId: 'string', name: 'string'})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.cloudraker.com/workspace/sessions/<sessionId>/artifacts/<artifactId>/commit"

payload = {
    "spaceId": "string",
    "name": "string"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 200

The committed artifact.

### 400

`cannot_target_desk` — a desk is never a commit target.

### 403

`forbidden` — the caller reads the target space but holds no `space:contribute` on it.

### 404

`not_found` — no such session for the caller, or no such target space; `artifact_not_found` — no such artifact in this session.


Source: https://docs.cloudraker.com/workspace/api/workspace-sessions/commit-workspace-artifact/index.md
