For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
预约演示登录免费开始
  • 概览
    • 什么是 API 定义?
    • 项目结构
      • 概览
      • 身份验证
      • 类型
        • 概览
        • HTTP JSON 端点
        • 多部分表单上传
        • 字节
        • 服务器发送事件
Checking status...
SOC2Soc 2 Type II
© 2026 Fern • Birch Solutions, Inc., a Postman company

Documentation

SDKsDocsAsk FernCLI Reference

API Definitions

OpenAPIAsyncAPIOpenRPCgRPC

Resources

BlogSupportPricing

Company

Brand KitPrivacy PolicyTerms of Service
LogoLogo
预约演示登录免费开始
在本页
  • 发送字节
  • 接收字节
Fern 定义端点

二进制数据和文件

使用 bytes 类型在您的 API 中处理二进制数据

||以 Markdown 格式查看|
此页面是否有帮助?
在仪表板中编辑
上一个

多部分文件上传

下一个

服务器发送事件和流式 API

bytes 类型允许您在请求和响应中处理二进制数据。

发送字节

如果您的 API 需要发送字节流(即音频、图像和其他文件等资源的典型用法),那么您可以在 Fern 定义中使用 bytes 类型来建模。

audio.yml
1service:
2 base-path: /audio
3 endpoints:
4 upload:
5 display-name: Upload audio
6 method: POST
7 path: /upload
8 content-type: application/octet-stream
9 request:
10 type: bytes
11 docs: The bytes of the MP3 file that you would like to upload

接收字节

在响应中处理二进制数据时,使用 type: file 而不是 type: bytes。

另一方面,如果您的 API 要返回字节流,那么您可以利用 bytes 类型作为响应。

textToSpeech.yml
1service:
2 base-path: /tts
3 endpoints:
4 upload:
5 display-name: Upload audio
6 method: POST
7 path: ""
8 request:
9 name: TTSRequest
10 body:
11 properties:
12 text:
13 type: string
14 docs: The text that you want converted to speech.
15 response:
16 type: file
17 docs: The bytes of the audio file.