> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # getChunk > Retrieve a specific chunk from a document. Retrieve a specific chunk from a document. ### Schema ```yaml openapi: 3.1.0 info: title: API version: 1.0.0 paths: /api/datasphere/documents/{documentId}/chunks/{chunkId}: get: operationId: subpackageChunks_get_document_chunk summary: Get chunk description: >- Retrieves one generated chunk by document and chunk IDs. Use it to inspect a known stored passage; use [List chunks](/docs/apis/rest/chunks/list-document-chunks) to discover chunk IDs or [Search documents](/docs/apis/rest/documents/search-documents) when starting from a natural-language query. #### Permissions The API token used to authenticate must have the following scope(s) enabled to make a successful request: _DataSphere_. [Learn more about API scopes](/docs/platform/your-signalwire-api-space). tags: - subpackage_chunks parameters: - name: documentId in: path description: Unique ID of the parent Document. required: true schema: $ref: '#/components/schemas/uuid' - name: chunkId in: path description: Unique ID of a Chunk. required: true schema: $ref: '#/components/schemas/uuid' responses: '200': description: The request has succeeded. content: application/json: schema: $ref: '#/components/schemas/Datasphere.ChunkResponse' '400': description: The request is invalid. content: application/json: schema: $ref: '#/components/schemas/Types.StatusCodes.StatusCode400' '401': description: Access is unauthorized. content: application/json: schema: $ref: '#/components/schemas/Types.StatusCodes.StatusCode401' '404': description: The server cannot find the requested resource. content: application/json: schema: $ref: '#/components/schemas/Types.StatusCodes.StatusCode404' '500': description: An internal server error occurred. content: application/json: schema: $ref: '#/components/schemas/Types.StatusCodes.StatusCode500' tags: - name: subpackage_chunks servers: - url: https://%7BYour_Space_Name%7D.signalwire.com description: SignalWire API components: schemas: uuid: type: string format: uuid description: Universal Unique Identifier. title: uuid Datasphere.ChunkStatus: type: string enum: - submitted - in_progress - completed - failed description: The current Status of the Chunk. title: Datasphere.ChunkStatus Datasphere.ChunkResponse: type: object properties: id: $ref: '#/components/schemas/uuid' description: Unique ID of the chunk. datasphere_document_id: $ref: '#/components/schemas/uuid' description: Unique ID of the chunk's datasphere document. project_id: $ref: '#/components/schemas/uuid' description: Unique ID of the project. status: $ref: '#/components/schemas/Datasphere.ChunkStatus' description: Status of the chunk. tags: type: array items: type: string description: The tags of the document associated with the chunk. content: type: string description: Content of the chunk. created_at: type: string format: date-time description: Chunk Creation Date. updated_at: type: string format: date-time description: Chunk Update Date. required: - id - datasphere_document_id - project_id - status - tags - content - created_at - updated_at title: Datasphere.ChunkResponse TypesStatusCodesStatusCode400Error: type: string enum: - Bad Request title: TypesStatusCodesStatusCode400Error Types.StatusCodes.StatusCode400: type: object properties: error: $ref: '#/components/schemas/TypesStatusCodesStatusCode400Error' required: - error description: The request is invalid. title: Types.StatusCodes.StatusCode400 TypesStatusCodesStatusCode401Error: type: string enum: - Unauthorized title: TypesStatusCodesStatusCode401Error Types.StatusCodes.StatusCode401: type: object properties: error: $ref: '#/components/schemas/TypesStatusCodesStatusCode401Error' required: - error description: Access is unauthorized. title: Types.StatusCodes.StatusCode401 TypesStatusCodesStatusCode404Error: type: string enum: - Not Found title: TypesStatusCodesStatusCode404Error Types.StatusCodes.StatusCode404: type: object properties: error: $ref: '#/components/schemas/TypesStatusCodesStatusCode404Error' required: - error description: The server cannot find the requested resource. title: Types.StatusCodes.StatusCode404 TypesStatusCodesStatusCode500Error: type: string enum: - Internal Server Error title: TypesStatusCodesStatusCode500Error Types.StatusCodes.StatusCode500: type: object properties: error: $ref: '#/components/schemas/TypesStatusCodesStatusCode500Error' required: - error description: An internal server error occurred. title: Types.StatusCodes.StatusCode500 ``` ## **Response Example** ### Response (200) ```json { "id": "acaa5c49-be5e-4477-bce0-48f4b23b7720", "datasphere_document_id": "acaa5c49-be5e-4477-bce0-48f4b23b7720", "project_id": "d369a402-7b43-4512-8735-9d5e1f387814", "status": "completed", "tags": [ "sports", "football", "game" ], "content": "This is the content from the original document that was chunked.", "created_at": "2024-05-06T12:20-12Z", "updated_at": "2024-05-06T12:20-12Z" } ``` ## **Example** ```typescript {9} import { RestClient } from "@signalwire/sdk"; const client = new RestClient({ project: "your-project-id", token: "your-api-token", host: "your-space.signalwire.com" }); const chunk = await client.datasphere.documents.getChunk("document-id", "chunk-id"); console.log(chunk.text); ``` > Retrieve a specific chunk from a document.