# copyUploadedFileToSpace

Copy an upload's original file (listFiles `uploads[].file.id`) into a folder or root you can edit, as Uploads' "Copy to My files" does: a new file of your own, independent of the upload. Needs EDITOR there.

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

## Variables

- `input`: `CopyUploadedFileIntoSpaceInput!` (required)
  - `uploadedFileId`: `ID!` (required). The upload's original file (FileProcessingTask.file).
  - `destination`: `SpaceDestinationInput!` (required)
    - `spaceId`: `ID!` (required)
    - `folderId`: `ID`. Null for the space root.

## Response (data, an example)

```json
{
  "spacesMutation": {
    "copyUploadedFile": {
      "id": "<ID>",
      "spaceId": "<ID>",
      "parentId": "<ID>",
      "name": "…",
      "fileType": "…",
      "sizeBytes": 0,
      "path": [
        {
          "id": "<ID>",
          "name": "…"
        }
      ]
    }
  }
}
```

## 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": "copyUploadedFileToSpace",
    "variables": {
      "input": {
        "uploadedFileId": "<uploadedFileId>",
        "destination": {
          "spaceId": "<spaceId>"
        }
      }
    }
  }'
```
