What is the Accept-Language header and how is it used?
Answer
The Accept-Language request header indicates the client's preferred human language for the response. Example: Accept-Language: en-US,en;q=0.9,fr;q=0.8 — the client prefers American English, then any English, then French. The server uses this to return localized content: translated messages, locale-specific date formats, and currency symbols. APIs that support internationalization parse this header and return content in the preferred language. The q factor (quality value, 0.0–1.0) indicates preference priority. If the server does not support the requested language, it falls back to a default (usually English). This header enables the same API endpoint to serve content in multiple languages without requiring separate endpoints per locale.
Previous
What is API documentation and what is Swagger/OpenAPI?
Next
What is a base URL and how should it be structured?
More REST API Design Questions
View all →- Beginner What is REST and what are its six architectural constraints?
- Beginner What are the main HTTP methods used in REST APIs and what do they do?
- Beginner What is idempotency and which HTTP methods are idempotent?
- Beginner What are the most important HTTP status codes in REST APIs?
- Beginner What are REST resource naming conventions?