> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt. # Endpoint schema snippet > Reference an endpoint schema from your API Reference The `` component displays endpoint schemas from your API Reference. By default, it renders the complete schema, or you can use the `selector` prop to display specific parts like request body, response, path parameters, or query parameters. When AI agents fetch the [Markdown version](/learn/docs/ai-features/markdown) of a page, Fern renders the schema — field names, types, and descriptions — as structured content in the Markdown output. To display any type definition by name (not limited to endpoint schemas), use the [``](/learn/docs/writing-content/components/schema) component. Markdown-rich field descriptions aren't yet supported and will display as plain text. See the [Request path](#request-path) example below. ## Usage ### Schema ```yaml openapi: 3.1.0 info: title: API version: 1.0.0 paths: /chat/{domain}: post: operationId: subpackageChat_post_chat_completion summary: Post Chat Completion tags: - subpackage_chat parameters: - name: domain in: path required: true schema: type: string responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/PostChatCompletionResponse' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' requestBody: content: application/json: schema: $ref: '#/components/schemas/PostChatCompletionRequest' tags: - name: subpackage_chat servers: - url: https://fai.buildwithfern.com description: Production - url: https://fai-dev.buildwithfern.com description: Development - url: http://localhost:8080 description: Local components: schemas: LanguageModel: type: string enum: - claude-4-sonnet - claude-4.5-haiku - claude-4.5-sonnet - claude-4.6-sonnet title: LanguageModel ChatMessageRole: type: string enum: - user - assistant title: ChatMessageRole ChatMessage: type: object properties: role: $ref: '#/components/schemas/ChatMessageRole' content: type: string required: - role - content title: ChatMessage PostChatCompletionRequest: type: object properties: model: oneOf: - $ref: '#/components/schemas/LanguageModel' - type: 'null' description: The model to use for the chat completion max_tokens: type: - integer - 'null' minimum: 100 maximum: 3500 default: 3000 description: >- The maximum number of tokens to generate. Note: setting a token count lower than 2000 may result in incomplete responses. You can add a custom system prompt to control the verbosity of the response. system_prompt: type: - string - 'null' description: The system prompt to use for the chat completion messages: type: array items: $ref: '#/components/schemas/ChatMessage' description: The messages to use for the chat completion rewrite_query: type: - boolean - 'null' default: false description: Whether to rewrite the query using query decomposition required: - messages title: PostChatCompletionRequest PostChatCompletionResponse: type: object properties: turns: type: array items: $ref: '#/components/schemas/ChatMessage' description: The conversation turns in the chat completion citations: type: array items: type: string description: List of citation strings required: - turns - citations title: PostChatCompletionResponse ValidationErrorLocItems: oneOf: - type: string - type: integer title: ValidationErrorLocItems ValidationError: type: object properties: loc: type: array items: $ref: '#/components/schemas/ValidationErrorLocItems' msg: type: string type: type: string required: - loc - msg - type title: ValidationError HTTPValidationError: type: object properties: detail: type: array items: $ref: '#/components/schemas/ValidationError' title: HTTPValidationError ``` **`Markdown`** ```jsx Markdown ``` ## Variants ### Full request Passing `request` as the selector will only render the request schema. ### Schema (`request`) ```yaml openapi: 3.1.0 info: title: API version: 1.0.0 paths: /chat/{domain}: post: operationId: subpackageChat_post_chat_completion summary: Post Chat Completion tags: - subpackage_chat parameters: - name: domain in: path required: true schema: type: string responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/PostChatCompletionResponse' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' requestBody: content: application/json: schema: $ref: '#/components/schemas/PostChatCompletionRequest' tags: - name: subpackage_chat servers: - url: https://fai.buildwithfern.com description: Production - url: https://fai-dev.buildwithfern.com description: Development - url: http://localhost:8080 description: Local components: schemas: LanguageModel: type: string enum: - claude-4-sonnet - claude-4.5-haiku - claude-4.5-sonnet - claude-4.6-sonnet title: LanguageModel ChatMessageRole: type: string enum: - user - assistant title: ChatMessageRole ChatMessage: type: object properties: role: $ref: '#/components/schemas/ChatMessageRole' content: type: string required: - role - content title: ChatMessage PostChatCompletionRequest: type: object properties: model: oneOf: - $ref: '#/components/schemas/LanguageModel' - type: 'null' description: The model to use for the chat completion max_tokens: type: - integer - 'null' minimum: 100 maximum: 3500 default: 3000 description: >- The maximum number of tokens to generate. Note: setting a token count lower than 2000 may result in incomplete responses. You can add a custom system prompt to control the verbosity of the response. system_prompt: type: - string - 'null' description: The system prompt to use for the chat completion messages: type: array items: $ref: '#/components/schemas/ChatMessage' description: The messages to use for the chat completion rewrite_query: type: - boolean - 'null' default: false description: Whether to rewrite the query using query decomposition required: - messages title: PostChatCompletionRequest PostChatCompletionResponse: type: object properties: turns: type: array items: $ref: '#/components/schemas/ChatMessage' description: The conversation turns in the chat completion citations: type: array items: type: string description: List of citation strings required: - turns - citations title: PostChatCompletionResponse ValidationErrorLocItems: oneOf: - type: string - type: integer title: ValidationErrorLocItems ValidationError: type: object properties: loc: type: array items: $ref: '#/components/schemas/ValidationErrorLocItems' msg: type: string type: type: string required: - loc - msg - type title: ValidationError HTTPValidationError: type: object properties: detail: type: array items: $ref: '#/components/schemas/ValidationError' title: HTTPValidationError ``` **`Markdown`** ```jsx Markdown ``` ### Request path ### Schema (`request.path`) ```yaml openapi: 3.1.0 info: title: API version: 1.0.0 paths: /chat/{domain}: post: operationId: subpackageChat_post_chat_completion summary: Post Chat Completion tags: - subpackage_chat parameters: - name: domain in: path required: true schema: type: string responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/PostChatCompletionResponse' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' requestBody: content: application/json: schema: $ref: '#/components/schemas/PostChatCompletionRequest' tags: - name: subpackage_chat servers: - url: https://fai.buildwithfern.com description: Production - url: https://fai-dev.buildwithfern.com description: Development - url: http://localhost:8080 description: Local components: schemas: LanguageModel: type: string enum: - claude-4-sonnet - claude-4.5-haiku - claude-4.5-sonnet - claude-4.6-sonnet title: LanguageModel ChatMessageRole: type: string enum: - user - assistant title: ChatMessageRole ChatMessage: type: object properties: role: $ref: '#/components/schemas/ChatMessageRole' content: type: string required: - role - content title: ChatMessage PostChatCompletionRequest: type: object properties: model: oneOf: - $ref: '#/components/schemas/LanguageModel' - type: 'null' description: The model to use for the chat completion max_tokens: type: - integer - 'null' minimum: 100 maximum: 3500 default: 3000 description: >- The maximum number of tokens to generate. Note: setting a token count lower than 2000 may result in incomplete responses. You can add a custom system prompt to control the verbosity of the response. system_prompt: type: - string - 'null' description: The system prompt to use for the chat completion messages: type: array items: $ref: '#/components/schemas/ChatMessage' description: The messages to use for the chat completion rewrite_query: type: - boolean - 'null' default: false description: Whether to rewrite the query using query decomposition required: - messages title: PostChatCompletionRequest PostChatCompletionResponse: type: object properties: turns: type: array items: $ref: '#/components/schemas/ChatMessage' description: The conversation turns in the chat completion citations: type: array items: type: string description: List of citation strings required: - turns - citations title: PostChatCompletionResponse ValidationErrorLocItems: oneOf: - type: string - type: integer title: ValidationErrorLocItems ValidationError: type: object properties: loc: type: array items: $ref: '#/components/schemas/ValidationErrorLocItems' msg: type: string type: type: string required: - loc - msg - type title: ValidationError HTTPValidationError: type: object properties: detail: type: array items: $ref: '#/components/schemas/ValidationError' title: HTTPValidationError ``` **`Markdown`** ```jsx Markdown ``` ### Request query ### Schema (`request.query`) ```yaml openapi: 3.1.0 info: title: API version: 1.0.0 paths: /chat/{domain}: post: operationId: subpackageChat_post_chat_completion summary: Post Chat Completion tags: - subpackage_chat parameters: - name: domain in: path required: true schema: type: string responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/PostChatCompletionResponse' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' requestBody: content: application/json: schema: $ref: '#/components/schemas/PostChatCompletionRequest' tags: - name: subpackage_chat servers: - url: https://fai.buildwithfern.com description: Production - url: https://fai-dev.buildwithfern.com description: Development - url: http://localhost:8080 description: Local components: schemas: LanguageModel: type: string enum: - claude-4-sonnet - claude-4.5-haiku - claude-4.5-sonnet - claude-4.6-sonnet title: LanguageModel ChatMessageRole: type: string enum: - user - assistant title: ChatMessageRole ChatMessage: type: object properties: role: $ref: '#/components/schemas/ChatMessageRole' content: type: string required: - role - content title: ChatMessage PostChatCompletionRequest: type: object properties: model: oneOf: - $ref: '#/components/schemas/LanguageModel' - type: 'null' description: The model to use for the chat completion max_tokens: type: - integer - 'null' minimum: 100 maximum: 3500 default: 3000 description: >- The maximum number of tokens to generate. Note: setting a token count lower than 2000 may result in incomplete responses. You can add a custom system prompt to control the verbosity of the response. system_prompt: type: - string - 'null' description: The system prompt to use for the chat completion messages: type: array items: $ref: '#/components/schemas/ChatMessage' description: The messages to use for the chat completion rewrite_query: type: - boolean - 'null' default: false description: Whether to rewrite the query using query decomposition required: - messages title: PostChatCompletionRequest PostChatCompletionResponse: type: object properties: turns: type: array items: $ref: '#/components/schemas/ChatMessage' description: The conversation turns in the chat completion citations: type: array items: type: string description: List of citation strings required: - turns - citations title: PostChatCompletionResponse ValidationErrorLocItems: oneOf: - type: string - type: integer title: ValidationErrorLocItems ValidationError: type: object properties: loc: type: array items: $ref: '#/components/schemas/ValidationErrorLocItems' msg: type: string type: type: string required: - loc - msg - type title: ValidationError HTTPValidationError: type: object properties: detail: type: array items: $ref: '#/components/schemas/ValidationError' title: HTTPValidationError ``` **`Markdown`** ```jsx Markdown ``` ### Request body ### Schema (`request.body`) ```yaml openapi: 3.1.0 info: title: API version: 1.0.0 paths: /chat/{domain}: post: operationId: subpackageChat_post_chat_completion summary: Post Chat Completion tags: - subpackage_chat parameters: - name: domain in: path required: true schema: type: string responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/PostChatCompletionResponse' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' requestBody: content: application/json: schema: $ref: '#/components/schemas/PostChatCompletionRequest' tags: - name: subpackage_chat servers: - url: https://fai.buildwithfern.com description: Production - url: https://fai-dev.buildwithfern.com description: Development - url: http://localhost:8080 description: Local components: schemas: LanguageModel: type: string enum: - claude-4-sonnet - claude-4.5-haiku - claude-4.5-sonnet - claude-4.6-sonnet title: LanguageModel ChatMessageRole: type: string enum: - user - assistant title: ChatMessageRole ChatMessage: type: object properties: role: $ref: '#/components/schemas/ChatMessageRole' content: type: string required: - role - content title: ChatMessage PostChatCompletionRequest: type: object properties: model: oneOf: - $ref: '#/components/schemas/LanguageModel' - type: 'null' description: The model to use for the chat completion max_tokens: type: - integer - 'null' minimum: 100 maximum: 3500 default: 3000 description: >- The maximum number of tokens to generate. Note: setting a token count lower than 2000 may result in incomplete responses. You can add a custom system prompt to control the verbosity of the response. system_prompt: type: - string - 'null' description: The system prompt to use for the chat completion messages: type: array items: $ref: '#/components/schemas/ChatMessage' description: The messages to use for the chat completion rewrite_query: type: - boolean - 'null' default: false description: Whether to rewrite the query using query decomposition required: - messages title: PostChatCompletionRequest PostChatCompletionResponse: type: object properties: turns: type: array items: $ref: '#/components/schemas/ChatMessage' description: The conversation turns in the chat completion citations: type: array items: type: string description: List of citation strings required: - turns - citations title: PostChatCompletionResponse ValidationErrorLocItems: oneOf: - type: string - type: integer title: ValidationErrorLocItems ValidationError: type: object properties: loc: type: array items: $ref: '#/components/schemas/ValidationErrorLocItems' msg: type: string type: type: string required: - loc - msg - type title: ValidationError HTTPValidationError: type: object properties: detail: type: array items: $ref: '#/components/schemas/ValidationError' title: HTTPValidationError ``` **`Markdown`** ```jsx Markdown ``` ### Full response Passing `response` as the selector will only render the response schema. ### Schema (`response`) ```yaml openapi: 3.1.0 info: title: API version: 1.0.0 paths: /chat/{domain}: post: operationId: subpackageChat_post_chat_completion summary: Post Chat Completion tags: - subpackage_chat parameters: - name: domain in: path required: true schema: type: string responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/PostChatCompletionResponse' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' requestBody: content: application/json: schema: $ref: '#/components/schemas/PostChatCompletionRequest' tags: - name: subpackage_chat servers: - url: https://fai.buildwithfern.com description: Production - url: https://fai-dev.buildwithfern.com description: Development - url: http://localhost:8080 description: Local components: schemas: LanguageModel: type: string enum: - claude-4-sonnet - claude-4.5-haiku - claude-4.5-sonnet - claude-4.6-sonnet title: LanguageModel ChatMessageRole: type: string enum: - user - assistant title: ChatMessageRole ChatMessage: type: object properties: role: $ref: '#/components/schemas/ChatMessageRole' content: type: string required: - role - content title: ChatMessage PostChatCompletionRequest: type: object properties: model: oneOf: - $ref: '#/components/schemas/LanguageModel' - type: 'null' description: The model to use for the chat completion max_tokens: type: - integer - 'null' minimum: 100 maximum: 3500 default: 3000 description: >- The maximum number of tokens to generate. Note: setting a token count lower than 2000 may result in incomplete responses. You can add a custom system prompt to control the verbosity of the response. system_prompt: type: - string - 'null' description: The system prompt to use for the chat completion messages: type: array items: $ref: '#/components/schemas/ChatMessage' description: The messages to use for the chat completion rewrite_query: type: - boolean - 'null' default: false description: Whether to rewrite the query using query decomposition required: - messages title: PostChatCompletionRequest PostChatCompletionResponse: type: object properties: turns: type: array items: $ref: '#/components/schemas/ChatMessage' description: The conversation turns in the chat completion citations: type: array items: type: string description: List of citation strings required: - turns - citations title: PostChatCompletionResponse ValidationErrorLocItems: oneOf: - type: string - type: integer title: ValidationErrorLocItems ValidationError: type: object properties: loc: type: array items: $ref: '#/components/schemas/ValidationErrorLocItems' msg: type: string type: type: string required: - loc - msg - type title: ValidationError HTTPValidationError: type: object properties: detail: type: array items: $ref: '#/components/schemas/ValidationError' title: HTTPValidationError ``` **`Markdown`** ```jsx Markdown ``` ### Response body ### Schema (`response.body`) ```yaml openapi: 3.1.0 info: title: API version: 1.0.0 paths: /chat/{domain}: post: operationId: subpackageChat_post_chat_completion summary: Post Chat Completion tags: - subpackage_chat parameters: - name: domain in: path required: true schema: type: string responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/PostChatCompletionResponse' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' requestBody: content: application/json: schema: $ref: '#/components/schemas/PostChatCompletionRequest' tags: - name: subpackage_chat servers: - url: https://fai.buildwithfern.com description: Production - url: https://fai-dev.buildwithfern.com description: Development - url: http://localhost:8080 description: Local components: schemas: LanguageModel: type: string enum: - claude-4-sonnet - claude-4.5-haiku - claude-4.5-sonnet - claude-4.6-sonnet title: LanguageModel ChatMessageRole: type: string enum: - user - assistant title: ChatMessageRole ChatMessage: type: object properties: role: $ref: '#/components/schemas/ChatMessageRole' content: type: string required: - role - content title: ChatMessage PostChatCompletionRequest: type: object properties: model: oneOf: - $ref: '#/components/schemas/LanguageModel' - type: 'null' description: The model to use for the chat completion max_tokens: type: - integer - 'null' minimum: 100 maximum: 3500 default: 3000 description: >- The maximum number of tokens to generate. Note: setting a token count lower than 2000 may result in incomplete responses. You can add a custom system prompt to control the verbosity of the response. system_prompt: type: - string - 'null' description: The system prompt to use for the chat completion messages: type: array items: $ref: '#/components/schemas/ChatMessage' description: The messages to use for the chat completion rewrite_query: type: - boolean - 'null' default: false description: Whether to rewrite the query using query decomposition required: - messages title: PostChatCompletionRequest PostChatCompletionResponse: type: object properties: turns: type: array items: $ref: '#/components/schemas/ChatMessage' description: The conversation turns in the chat completion citations: type: array items: type: string description: List of citation strings required: - turns - citations title: PostChatCompletionResponse ValidationErrorLocItems: oneOf: - type: string - type: integer title: ValidationErrorLocItems ValidationError: type: object properties: loc: type: array items: $ref: '#/components/schemas/ValidationErrorLocItems' msg: type: string type: type: string required: - loc - msg - type title: ValidationError HTTPValidationError: type: object properties: detail: type: array items: $ref: '#/components/schemas/ValidationError' title: HTTPValidationError ``` **`Markdown`** ```jsx Markdown ``` ## Properties **`endpoint`** `string` — required The endpoint to display, in the format `METHOD /path` (e.g., `POST /chat/{domain}`). If your API uses [namespaces](/learn/api-definitions/overview/project-structure#combined-sdks-from-multiple-apis), prefix with the namespace and `::` (e.g., `payments::POST /chat/{domain}`). --- **`selector`** `string` Selects a specific part of the endpoint schema to display. Supported values: `request`, `request.path`, `request.query`, `request.body`, `response`, `response.body`. --- > Reference an endpoint schema from your API Reference