Generations API – GET /api/generations/{id}
Retrieve a specific generation by its unique ID. This endpoint returns all metadata and the generated content for a given generation belonging to the authenticated user.
Endpoint
| Path | Description |
|---|---|
/api/generations/{id} |
Fetch a single generation by its database ID. |
This route lives under Sanctum authentication middleware .
Authentication
All requests require a valid API token in the Authorization header:
Authorization: Bearer <your_token_here>
Path Parameter
| Name | Type | Description |
|---|---|---|
| id | integer | The database ID of the generation to retrieve. |
Success Response (200 OK)
Returns a JSON payload with generation details:
{
"success": true,
"data": {
"uuid": "123e4567-e89b-12d3-a456-426614174000",
"generated_by_user_email": "[email protected]",
"filename": "TestClass.php",
"generated": "## TestClass\nDetailed documentation content …",
"created_at": "2025-01-15T10:20:30Z",
"updated_at": "2025-01-15T10:20:30Z",
"generation_type": "documentation",
"tag": "v1.0"
}
}
- uuid: Public identifier for sharing.
- generatedbyuser_email: Email of the creator.
- filename: Original file name.
- generated: The Markdown content produced.
- createdat / updatedat: Timestamps in ISO 8601.
- generation_type: Type (e.g.,
documentation,tests). - tag: User‐defined grouping label.
Error Responses
- 401 Unauthorized
- Missing or invalid token.
{ "message": "Unauthenticated." }
- 404 Not Found
- No matching generation or it belongs to another user.
{
"message": "Not found"
}
Example Request
curl -X GET "https://app.docuwriter.ai/api/generations/42" \
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJI..."
Interactive API Block
{
"title": "Get Generation by ID",
"description": "Retrieves a specific generation resource for the authenticated user.",
"method": "GET",
"baseUrl": "https://app.docuwriter.ai",
"endpoint": "/api/generations/{id}",
"headers": [
{
"key": "Authorization",
"value": "Bearer <token>",
"required": true
}
],
"queryParams": [],
"pathParams": [
{
"key": "id",
"value": "Generation ID",
"required": true
}
],
"bodyType": "none",
"requestBody": "",
"formData": [],
"rawBody": "",
"responses": {
"200": {
"description": "Successful retrieval of generation.",
"body": "{\n \"success\": true,\n \"data\": { /* ... */ }\n}"
},
"401": {
"description": "Authentication required.",
"body": "{\n \"message\": \"Unauthenticated.\"\n}"
},
"404": {
"description": "Generation not found or unauthorized.",
"body": "{\n \"message\": \"No query results for model [App\\\\Models\\\\Generation] 42\"\n}"
}
}
}
Updated