# getFileChunk

```graphql
query GetFileChunk($input: GetFileChunkInput!) {
  getFileChunk(input: $input) {
    id
    file {
      id
      path
      versionId
      checksum
    }
    index
    content
    position {
      startOffset
      endOffset
    }
    metadata {
      tokenCount
      sourceChecksum
      createdAt
      custom
    }
    embedding {
      id
      status
      vector
      createdAt
    }
  }
}
```

Return file chunk. Requires project.knowledge.read.

## Arguments

| Name                       | Type               | Required | Description                                                                                  |
| -------------------------- | ------------------ | -------- | -------------------------------------------------------------------------------------------- |
| `input`                    | GetFileChunkInput! | Yes      |                                                                                              |
| `input.chunkId`            | ID!                | Yes      |                                                                                              |
| `input.environment`        | SearchEnvironment! | Yes      | Deployment environment containing the chunk One of `PREVIEW`, `PRODUCTION`, `RELEASE`.       |
| `input.branchId`           | ID                 |          | Branch ID for PREVIEW environment (null or omitted selects main)                             |
| `input.releaseId`          | ID                 |          | Release ID for RELEASE environment. Provide exactly one of releaseId or releaseVersion.      |
| `input.releaseVersion`     | String             |          | Release version for RELEASE environment. Provide exactly one of releaseId or releaseVersion. |
| `input.includeEmbedding`   | Boolean            |          | Include embedding metadata; defaults to false. Requires embeddingDimension when true.        |
| `input.embeddingDimension` | EmbeddingDimension |          | One of `D768`, `D1024`, `D1536`, `D3072`, `D4096`.                                           |
| `input.includeVector`      | Boolean            |          | Include the raw vector when an embedding is selected; defaults to false.                     |

## Variables

```json
{
  "input": {
    "chunkId": "string",
    "environment": "PREVIEW"
  }
}
```

## Responses

| Status | Description                         |
| ------ | ----------------------------------- |
| 200    | The FileChunk in data.getFileChunk. |

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "query GetFileChunk($input: GetFileChunkInput!) {\n  getFileChunk(input: $input) {\n    id\n    file {\n      id\n      path\n      versionId\n      checksum\n    }\n    index\n    content\n    position {\n      startOffset\n      endOffset\n    }\n    metadata {\n      tokenCount\n      sourceChecksum\n      createdAt\n      custom\n    }\n    embedding {\n      id\n      status\n      vector\n      createdAt\n    }\n  }\n}",
  "variables": {
    "input": {
      "chunkId": "string",
      "environment": "PREVIEW"
    }
  }
}'
```

## Example response

```json
{
  "data": {
    "getFileChunk": {
      "id": "string",
      "file": {
        "id": "string",
        "path": "string",
        "versionId": "string",
        "checksum": "string"
      },
      "index": 0,
      "content": "string",
      "position": {
        "startOffset": 0,
        "endOffset": 0
      },
      "metadata": {
        "tokenCount": 0,
        "sourceChecksum": "string",
        "createdAt": "string",
        "custom": {}
      },
      "embedding": {
        "id": "string",
        "status": "READY",
        "vector": [0],
        "createdAt": "string"
      }
    }
  }
}
```
