# completeSpaceUpload

Finish an upload once its bytes are PUT: makes the file or its next version. A retry returns the same file. `actorGrn`: the dev session making it.

- Call: `POST https://server.goliathdata.com/api/v1/call` with `{ "operationId": "completeSpaceUpload", "variables": {...} }`
- Scope: `WRITE`
- Type: mutation
- Idempotency: honors `Idempotency-Key` (24 h)
- Rate-limited: no

## Variables

- `uploadId`: `ID!` (required)
- `expectedVersionId`: `ID`
- `actorGrn`: `String`

## Response (data, an example)

```json
{
  "spacesMutation": {
    "completeUpload": {
      "id": "<ID>",
      "spaceId": "<ID>",
      "parentId": "<ID>",
      "name": "…",
      "fileType": "…",
      "sizeBytes": 0,
      "currentVersion": {
        "id": "<ID>",
        "versionNumber": 0
      }
    }
  }
}
```

## Example

```bash
curl https://server.goliathdata.com/api/v1/call \
  -H "Authorization: Bearer $GOLIATH_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "operationId": "completeSpaceUpload",
    "variables": {
      "uploadId": "<uploadId>"
    }
  }'
```
