---
title: Extract Hair Region from Image API
slug: extract-hair-region
url: https://apyhub.com/dosvak/service/extract-hair-region
provider: Dosvak LLC
tags: [hair-segmentation, portrait-processing, image-masking, transparency, foreground-extraction]
auth: api_key
version: 1.0.0
service_type: sync
endpoints: 1
atoms: 100
---

# Extract Hair Region from Image API

Extract the hair region from a portrait image and return a transparent binary image. Built for avatar creation, retouching, and compositing.

## Endpoints

| Method | URL | Description | Atoms |
| --- | --- | --- | --- |
| POST | `https://api.eu.apyhub.com/dosvak/extract-hair-region` | What it does Extracts a heuristic hair region from a portrait image and returns the resulting image… | 100 |

## Endpoint reference

### Extract a heuristic hair region with transparency

`POST https://api.eu.apyhub.com/dosvak/extract-hair-region` · 100 atoms · accepts `multipart/form-data` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `file` | body | string (binary) | yes | Portrait image |
| `sensitivity` | query | number | no | Default: `0.55`. Example: `0.55`. |

#### Quickstart

Upload a portrait image to extract the hair region.

```bash
curl -X POST "https://api.eu.apyhub.com/dosvak/extract-hair-region" \
  -H "apy-token: $APY_TOKEN" \
  -F "file=@/path/to/portrait.jpg"
```

#### What you'll get back

Returns a binary file (`string` with `format: "binary"`), which is the extracted hair-region output.

## About

## What it does
Hair Region Extractor takes a portrait image and returns the image as a binary file with a heuristic hair region extracted and transparency applied. It is designed for image pipelines that need a quick foreground-style cutout around hair without building a custom segmentation model.

Send the image in the required `file` field, and optionally adjust `sensitivity` as a query parameter between 0.1 and 1. Lower values keep the extraction conservative; higher values make the region detection more aggressive. The response is a binary image, so you can pass it straight into storage, editing, or further compositing steps.

Use Hair Region Extractor when you need to isolate hair for avatar generation, portrait retouching, virtual try-on workflows, or design tools that layer effects behind a subject. Because the output is transparent, it fits cleanly into downstream image-processing pipelines without extra masking logic.

If you are working with user-uploaded portraits, this endpoint gives you a focused transformation step: one image in, one processed image out.

## Usage

Base URL: `https://api.eu.apyhub.com` (default region — see
`GET https://apyhub.com/api/public/regions` for the rest).

Authenticate with an ApyHub API key in the `apy-token` header.
Full docs and a live playground: https://apyhub.com/dosvak/service/extract-hair-region
