---
title: "Segment Anything 2"
method: POST
path: "/api/generate/segment-anything-2"
tags: ["generate"]
---

# Segment Anything 2

`POST /api/generate/segment-anything-2`

Segment objects in an image.

## Response `200`

Successful Response

- MasksResponse — Response model for object segmentation.
  - `masks` string, required — The generated masks.
  - `scores` string, required — The model's confidence scores for each generated mask.
  - `logits` string, required — The raw, unnormalized predictions (logits) for the masks.

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `422` — Validation Error
- `500` — Internal Server Error
- `default` — Error

## Changes

- **2025-10-30** `dfc937fc0d2c` — 6 breaking, 3 info
  - the `oneOf[subschema #1: HTTPError]/detail` response's property type/format changed from `object`/`` to ``/`` for status `400`
  - the `oneOf[subschema #1: HTTPError]/detail` response's property type/format changed from `object`/`` to ``/`` for status `401`
  - the `oneOf[subschema #1: HTTPError]/detail` response's property type/format changed from `object`/`` to ``/`` for status `500`
  - removed the required property `oneOf[subschema #1: HTTPError]/detail/msg` from the response with the `400` status
  - …5 more
- **2025-10-30** `f5d01b71ba9a` — 3 breaking, 6 info
  - the `oneOf[subschema #1: HTTPError]/detail` response's property type/format changed from ``/`` to `object`/`` for status `400`
  - the `oneOf[subschema #1: HTTPError]/detail` response's property type/format changed from ``/`` to `object`/`` for status `401`
  - the `oneOf[subschema #1: HTTPError]/detail` response's property type/format changed from ``/`` to `object`/`` for status `500`
  - removed `#/components/schemas/APIError` from the `oneOf[subschema #1: HTTPError]/detail` response property `allOf` list for the response status `400`
  - …5 more
- **2024-10-03** `cbf999b9a7cf` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/livepeer/apis/untitled-api/changes/api/generate/segment-anything-2/post.md)

---

[API](https://skmtc.dev/livepeer/apis/untitled-api.md) · [All operations](https://skmtc.dev/livepeer/apis/untitled-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/livepeer/untitled-api/revisions/dfc937fc0d2c/schema)
