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.
Book a demoLog inStart for free
  • Overview
    • What is an API definition?
    • Project structure
      • Overview
      • Authentication
      • Types
        • Overview
        • HTTP JSON endpoints
        • Multipart form uploads
        • Bytes
        • Server-sent events
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
Book a demoLog inStart for free
On this page
  • Sending bytes
  • Receiving bytes
Fern DefinitionEndpoints

Binary data and files

Use the bytes type to handle binary data in your API

||View as Markdown|
Was this page helpful?
Edit this page
Previous

Multipart file upload

Next

Server-sent events and streaming APIs

Fern Definition isn’t recommended for new customers and Fern isn’t accepting feature requests for this format. It remains supported for existing users.

The bytes type allows you to handle binary data in both requests and responses.

Sending bytes

If your API needs to send a stream of bytes (i.e. typical for assets like audio, images and other files) then you can use the bytes type in the Fern Definition to model this.

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

Receiving bytes

When handling binary data in responses, use type: file instead of type: bytes.

On the other hand, if your API is returning a stream of bytes, then you can leverage the bytes type as a response.

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.