---
title: "Update structured labels"
method: POST
path: "/api/{projectId}/raw-data/{sampleId}/structured-labels"
tags: ["Raw data"]
---

# Update structured labels

`POST /api/{projectId}/raw-data/{sampleId}/structured-labels`

## Request

- Base URL: `https://studio.edgeimpulse.com/v1`
- URL: `https://studio.edgeimpulse.com/v1/api/{projectId}/raw-data/{sampleId}/structured-labels`
- Auth: one of:
  - API key in header `x-api-key`
  - API key in cookie `jwt`
  - API key in header `x-jwt-token`
  - OAuth 2
    - Authorization code: `/v1/oauth/authorize`
    - Client credentials
    - Implicit: `/v1/oauth/authorize`
    - Password
    - Token URL: `/v1/oauth/token`
- TypeScript: <https://skmtc.dev/edgeimpulse/apis/edge-impulse-api/docs/api/:projectId/raw-data/:sampleId/structured-labels/post.ts> (a function with typed inputs; its response is checked against the schema)

Set structured labels for a sample. If a sample has structured labels the `label` column is ignored, and the sample is allowed to have multiple labels. An array of { startIndex, endIndex, label } needs to be passed in with labels for the complete sample (see `valuesCount` to get the upper bound). endIndex is _inclusive_. If you pass in an incorrect array (e.g. missing values) you'll get an error back.

## Path parameters

- `projectId` integer, required
- `sampleId` integer, required

## Request body

- SetSampleStructuredLabelsRequest
  - `structuredLabels` StructuredLabel[], required
    - `startIndex` integer, required: Start index of the label (e.g. 0)
    - `endIndex` integer, required: End index of the label (e.g. 3). This value is inclusive, so { startIndex: 0, endIndex: 3 } covers 0, 1, 2, 3.
    - `label` string, required: The label for this section.
    - `labelMap` SampleLabelMapLabels
      - `type` 'key-values', required
      - `labels` object, required

## Response `200`

OK

- GenericApiResponse
  - `success` boolean, required: Whether the operation succeeded
  - `error` string: Optional error description (set if 'success' was false)

---

[API](https://skmtc.dev/edgeimpulse/apis/edge-impulse-api.md) - [All operations](https://skmtc.dev/edgeimpulse/apis/edge-impulse-api/llms.txt) - [OpenAPI document](https://skmtc.dev/edgeimpulse/apis/edge-impulse-api/revisions/e2a976d38427?raw)
