Generate an example from open-source references
Generate a code example for a programming task using open-source references. The response contains Markdown with source references, license attribution, and a link to the saved example.
Use this endpoint when you want an example tailored to your task. To find existing documentation or code instead, use POST /v1/searches. You can rate a saved example with POST /v1/feedback.
curl --request POST \
--url https://api.githits.dev/v1/examples/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"language": "ts",
"license_mode": "custom",
"query": "Parse JSON"
}
'{
"result": "# Example\n\n```rust\nlet value = 1;\n```\n\n### References\n- [Source 1](https://example.org/source) (MIT)\n\n---\n\n[Open in GitHits Web App](https://app.githits.com/solutions/12345678-1234-4234-8234-123456789abc)\n",
"search_status": "complete",
"solution_id": "12345678-1234-4234-8234-123456789abc"
}Authorizations
Headers
Optional caller-defined session ID: one to 64 ASCII letters, digits, underscores or hyphens, preserved exactly. Supply the header at most once. Invalid supplied IDs return 400 INVALID_SESSION_ID; no session is created.
1 - 64^[A-Za-z0-9_-]{1,64}$Body
Generate one full markdown result; unknown or duplicate JSON keys are rejected.
Response
Full markdown with saved solution identity and source evidence completeness.
Unaltered markdown with its saved solution and source-evidence completeness.
curl --request POST \
--url https://api.githits.dev/v1/examples/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"language": "ts",
"license_mode": "custom",
"query": "Parse JSON"
}
'{
"result": "# Example\n\n```rust\nlet value = 1;\n```\n\n### References\n- [Source 1](https://example.org/source) (MIT)\n\n---\n\n[Open in GitHits Web App](https://app.githits.com/solutions/12345678-1234-4234-8234-123456789abc)\n",
"search_status": "complete",
"solution_id": "12345678-1234-4234-8234-123456789abc"
}