Skip to content

Add API request reference docs: request/response architecture, clientName, x-github-request-id - #1

Draft
Mouseww with Copilot wants to merge 4 commits into
mainfrom
copilot/analyze-copilot-request-headers
Draft

Add API request reference docs: request/response architecture, clientName, x-github-request-id#1
Mouseww with Copilot wants to merge 4 commits into
mainfrom
copilot/analyze-copilot-request-headers

Conversation

Copilot AI commented Mar 11, 2026

Copy link
Copy Markdown

Documents how the SDK communicates with the Copilot API via the CLI, with deep dives on clientName and x-github-request-id.

New: docs/api-request-reference.md

  • Architecture: SDK → JSON-RPC → CLI → HTTP → api.githubcopilot.com flow with diagrams
  • Authentication: Token priority order (6 levels), supported token formats
  • clientName: Data flow diagram, examples in all 4 languages for create/resume, JSON-RPC payload format, best practices
  • x-github-request-id: Response header → SDK event field mapping, distinguishes providerCallId (from API header, for GitHub support debugging) vs requestId (CLI-internal, for tool/permission round-trips)
  • Request/response format: OpenAI-compatible /chat/completions body, streaming SSE, BYOK provider differences
  • Troubleshooting: Debug logging, token verification, providerCallId for support correlation

Key disambiguation — requestId has two meanings:

Context Source Purpose
session.error, session.usage_infoproviderCallId x-github-request-id HTTP header Server-side log correlation
session.compaction_completerequestId x-github-request-id HTTP header Same (historical naming)
permission.requested, external_tool.requestedrequestId CLI-generated UUID Match request↔response callbacks

Updated: docs/index.md

Added API Request Reference to nav table and documentation map.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…ody format, and authentication flow

Co-authored-by: Mouseww <28473201+Mouseww@users.noreply.github.com>
Copilot AI changed the title [WIP] Analyze request body and headers for Copilot interface Add API request reference documentation Mar 11, 2026
Copilot AI and others added 2 commits March 11, 2026 15:51
…ws, all-language examples, and providerCallId vs requestId disambiguation

Co-authored-by: Mouseww <28473201+Mouseww@users.noreply.github.com>
…ify requestId in compaction events

Co-authored-by: Mouseww <28473201+Mouseww@users.noreply.github.com>
Copilot AI changed the title Add API request reference documentation Add API request reference docs: request/response architecture, clientName, x-github-request-id Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants