Poly Haven API
Server routes that proxy requests to the Poly Haven material library API.
Why Proxy?
The Poly Haven API is called through server routes to:
- Add server-side caching
- Handle rate limiting
- Normalize response format
- Keep API details server-side
GET /api/polyhaven/search
Search for textures/materials.
Query Parameters
| Param | Type | Description |
|---|---|---|
q | string | Search query |
type | string | Asset type (default: textures) |
categories | string | Comma-separated category filter |
limit | number | Max results |
Response
Returns normalized material objects with id, name, tags, categories, thumbnail_url, and download stats.
GET /api/polyhaven/categories
Get available texture categories.
Response
json
{
"categories": ["brick", "concrete", "fabric", "marble", "metal", "stone", "tile", "wood", ...]
}GET /api/polyhaven/info/[id]
Get detailed asset information.
Parameters
| Param | Type | Description |
|---|---|---|
id | string | Poly Haven asset slug |
GET /api/polyhaven/files/[id]
Get asset file URLs for different resolutions and formats.
Parameters
| Param | Type | Description |
|---|---|---|
id | string | Poly Haven asset slug |
Response
Returns texture maps (diffuse, normal, roughness, etc.) at various resolutions (1K, 2K, 4K).
Source
server/api/polyhaven/