---
title: "Delete a segment"
description: "409 segment_in_use when an environment's config of any flag references it."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.ezghcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: Feature Flags API

`DELETE /v1/organizations/{orgId}/projects/{projectId}/segments/{segmentId}`

409 segment_in_use when an environment's config of any flag references it.

## Authentication

Requires one of the following:

- `apiKey`, http, header `Authorization`
- `oauth`, http, header `Authorization`
- `sessionCookie`, apiKey, in cookie

## Path parameters

- `DeleteSegment.path.orgId` (string, required)
  - format `uuid`
- `DeleteSegment.path.projectId` (string, required)
  - format `uuid`
- `DeleteSegment.path.segmentId` (string, required)
  - format `uuid`

## Header parameters

- `DeleteSegment.header.If-Match` (string, optional) — The ETag as last read, or *. Without it the write isn't conditional; with a stale one it's 412.

## Code samples

### cURL

```curl
curl --request DELETE \
  --url https://flags-api.ezghcloud.com/v1/organizations/497f6eca-6276-4993-bfeb-53cbbbba6f08/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/segments/497f6eca-6276-4993-bfeb-53cbbbba6f08 \
  --header 'Authorization: Bearer <token>'
```

### TypeScript

```typescript
const url = 'https://flags-api.ezghcloud.com/v1/organizations/497f6eca-6276-4993-bfeb-53cbbbba6f08/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/segments/497f6eca-6276-4993-bfeb-53cbbbba6f08';
const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://flags-api.ezghcloud.com/v1/organizations/497f6eca-6276-4993-bfeb-53cbbbba6f08/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/segments/497f6eca-6276-4993-bfeb-53cbbbba6f08"

headers = {"Authorization": "Bearer <token>"}

response = requests.delete(url, headers=headers)

print(response.text)
```

## Responses

### 204

Deleted.

### 400

invalid_request (with issues), invalid_cursor, or the endpoint's own 400 codes.

#### Example

```json
{
  "error": {
    "code": "string",
    "issues": [
      {
        "message": "string",
        "path": "string"
      }
    ],
    "message": "string",
    "quota": {
      "id": "string",
      "inFlight": 0,
      "kind": "allocation",
      "limit": 0,
      "periodStart": "2019-08-24T14:15:22Z",
      "region": "string",
      "resetsAt": "2019-08-24T14:15:22Z",
      "scope": "organization",
      "scopeResourceName": "string",
      "used": 0,
      "window": "string"
    }
  }
}
```

- `DeleteSegment.response.400.error` (object, required)
  - `DeleteSegment.response.400.error.code` (string, required)
    - maxLength 64; pattern `^[a-z][a-z0-9_]*$`
  - `DeleteSegment.response.400.error.message` (string, required)
    - maxLength 1024
  - `DeleteSegment.response.400.error.issues` (array<object>, optional) — invalid_request: one entry per problem, at a dotted path.
    - `DeleteSegment.response.400.error.issues.message` (string, required)
    - `DeleteSegment.response.400.error.issues.path` (string, required)
  - `DeleteSegment.response.400.error.quota` (object, optional) — quota_exceeded: the quota that refused the request. Never with Retry-After.
    - `DeleteSegment.response.400.error.quota.id` (string, required)
    - `DeleteSegment.response.400.error.quota.kind` (unknown, required)
      - one of `"allocation"`, `"rate"`, `"usage"`, `"concurrency"`
    - `DeleteSegment.response.400.error.quota.limit` (integer, required)
      - min 0
    - `DeleteSegment.response.400.error.quota.scope` (unknown, required)
      - one of `"organization"`, `"project"`, `"resource"`
    - `DeleteSegment.response.400.error.quota.inFlight` (integer, optional)
      - min 0
    - `DeleteSegment.response.400.error.quota.periodStart` (string, optional)
      - format `date-time`
    - `DeleteSegment.response.400.error.quota.region` (string, optional)
    - `DeleteSegment.response.400.error.quota.resetsAt` (string, optional)
      - format `date-time`
    - `DeleteSegment.response.400.error.quota.scopeResourceName` (string, optional)
    - `DeleteSegment.response.400.error.quota.used` (integer, optional)
      - min 0
    - `DeleteSegment.response.400.error.quota.window` (string, optional) — rate only: an ISO 8601 duration, PT1S to PT1H.

### 401

unauthenticated: no credential, or one that doesn't check out.

#### Example

```json
{
  "error": {
    "code": "string",
    "issues": [
      {
        "message": "string",
        "path": "string"
      }
    ],
    "message": "string",
    "quota": {
      "id": "string",
      "inFlight": 0,
      "kind": "allocation",
      "limit": 0,
      "periodStart": "2019-08-24T14:15:22Z",
      "region": "string",
      "resetsAt": "2019-08-24T14:15:22Z",
      "scope": "organization",
      "scopeResourceName": "string",
      "used": 0,
      "window": "string"
    }
  }
}
```

- `DeleteSegment.response.401.error` (object, required)
  - `DeleteSegment.response.401.error.code` (string, required)
    - maxLength 64; pattern `^[a-z][a-z0-9_]*$`
  - `DeleteSegment.response.401.error.message` (string, required)
    - maxLength 1024
  - `DeleteSegment.response.401.error.issues` (array<object>, optional) — invalid_request: one entry per problem, at a dotted path.
    - `DeleteSegment.response.401.error.issues.message` (string, required)
    - `DeleteSegment.response.401.error.issues.path` (string, required)
  - `DeleteSegment.response.401.error.quota` (object, optional) — quota_exceeded: the quota that refused the request. Never with Retry-After.
    - `DeleteSegment.response.401.error.quota.id` (string, required)
    - `DeleteSegment.response.401.error.quota.kind` (unknown, required)
      - one of `"allocation"`, `"rate"`, `"usage"`, `"concurrency"`
    - `DeleteSegment.response.401.error.quota.limit` (integer, required)
      - min 0
    - `DeleteSegment.response.401.error.quota.scope` (unknown, required)
      - one of `"organization"`, `"project"`, `"resource"`
    - `DeleteSegment.response.401.error.quota.inFlight` (integer, optional)
      - min 0
    - `DeleteSegment.response.401.error.quota.periodStart` (string, optional)
      - format `date-time`
    - `DeleteSegment.response.401.error.quota.region` (string, optional)
    - `DeleteSegment.response.401.error.quota.resetsAt` (string, optional)
      - format `date-time`
    - `DeleteSegment.response.401.error.quota.scopeResourceName` (string, optional)
    - `DeleteSegment.response.401.error.quota.used` (integer, optional)
      - min 0
    - `DeleteSegment.response.401.error.quota.window` (string, optional) — rate only: an ISO 8601 duration, PT1S to PT1H.

### 403

access_denied: the caller's policies don't allow the action; forbidden_origin: a cookie-authenticated write from an origin that isn't allowed; spend_limit_reached.

#### Example

```json
{
  "error": {
    "code": "string",
    "issues": [
      {
        "message": "string",
        "path": "string"
      }
    ],
    "message": "string",
    "quota": {
      "id": "string",
      "inFlight": 0,
      "kind": "allocation",
      "limit": 0,
      "periodStart": "2019-08-24T14:15:22Z",
      "region": "string",
      "resetsAt": "2019-08-24T14:15:22Z",
      "scope": "organization",
      "scopeResourceName": "string",
      "used": 0,
      "window": "string"
    }
  }
}
```

- `DeleteSegment.response.403.error` (object, required)
  - `DeleteSegment.response.403.error.code` (string, required)
    - maxLength 64; pattern `^[a-z][a-z0-9_]*$`
  - `DeleteSegment.response.403.error.message` (string, required)
    - maxLength 1024
  - `DeleteSegment.response.403.error.issues` (array<object>, optional) — invalid_request: one entry per problem, at a dotted path.
    - `DeleteSegment.response.403.error.issues.message` (string, required)
    - `DeleteSegment.response.403.error.issues.path` (string, required)
  - `DeleteSegment.response.403.error.quota` (object, optional) — quota_exceeded: the quota that refused the request. Never with Retry-After.
    - `DeleteSegment.response.403.error.quota.id` (string, required)
    - `DeleteSegment.response.403.error.quota.kind` (unknown, required)
      - one of `"allocation"`, `"rate"`, `"usage"`, `"concurrency"`
    - `DeleteSegment.response.403.error.quota.limit` (integer, required)
      - min 0
    - `DeleteSegment.response.403.error.quota.scope` (unknown, required)
      - one of `"organization"`, `"project"`, `"resource"`
    - `DeleteSegment.response.403.error.quota.inFlight` (integer, optional)
      - min 0
    - `DeleteSegment.response.403.error.quota.periodStart` (string, optional)
      - format `date-time`
    - `DeleteSegment.response.403.error.quota.region` (string, optional)
    - `DeleteSegment.response.403.error.quota.resetsAt` (string, optional)
      - format `date-time`
    - `DeleteSegment.response.403.error.quota.scopeResourceName` (string, optional)
    - `DeleteSegment.response.403.error.quota.used` (integer, optional)
      - min 0
    - `DeleteSegment.response.403.error.quota.window` (string, optional) — rate only: an ISO 8601 duration, PT1S to PT1H.

### 404

not_found: unknown, malformed, or in an organization the caller isn't in.

#### Example

```json
{
  "error": {
    "code": "string",
    "issues": [
      {
        "message": "string",
        "path": "string"
      }
    ],
    "message": "string",
    "quota": {
      "id": "string",
      "inFlight": 0,
      "kind": "allocation",
      "limit": 0,
      "periodStart": "2019-08-24T14:15:22Z",
      "region": "string",
      "resetsAt": "2019-08-24T14:15:22Z",
      "scope": "organization",
      "scopeResourceName": "string",
      "used": 0,
      "window": "string"
    }
  }
}
```

- `DeleteSegment.response.404.error` (object, required)
  - `DeleteSegment.response.404.error.code` (string, required)
    - maxLength 64; pattern `^[a-z][a-z0-9_]*$`
  - `DeleteSegment.response.404.error.message` (string, required)
    - maxLength 1024
  - `DeleteSegment.response.404.error.issues` (array<object>, optional) — invalid_request: one entry per problem, at a dotted path.
    - `DeleteSegment.response.404.error.issues.message` (string, required)
    - `DeleteSegment.response.404.error.issues.path` (string, required)
  - `DeleteSegment.response.404.error.quota` (object, optional) — quota_exceeded: the quota that refused the request. Never with Retry-After.
    - `DeleteSegment.response.404.error.quota.id` (string, required)
    - `DeleteSegment.response.404.error.quota.kind` (unknown, required)
      - one of `"allocation"`, `"rate"`, `"usage"`, `"concurrency"`
    - `DeleteSegment.response.404.error.quota.limit` (integer, required)
      - min 0
    - `DeleteSegment.response.404.error.quota.scope` (unknown, required)
      - one of `"organization"`, `"project"`, `"resource"`
    - `DeleteSegment.response.404.error.quota.inFlight` (integer, optional)
      - min 0
    - `DeleteSegment.response.404.error.quota.periodStart` (string, optional)
      - format `date-time`
    - `DeleteSegment.response.404.error.quota.region` (string, optional)
    - `DeleteSegment.response.404.error.quota.resetsAt` (string, optional)
      - format `date-time`
    - `DeleteSegment.response.404.error.quota.scopeResourceName` (string, optional)
    - `DeleteSegment.response.404.error.quota.used` (integer, optional)
      - min 0
    - `DeleteSegment.response.404.error.quota.window` (string, optional) — rate only: an ISO 8601 duration, PT1S to PT1H.

### 409

quota_exceeded (an allocation quota, with quota), idempotency_conflict, idempotency_in_progress (with Retry-After), organization_deletion_pending, operation_in_progress, or the endpoint's own 409 codes.

#### Example

```json
{
  "error": {
    "code": "string",
    "issues": [
      {
        "message": "string",
        "path": "string"
      }
    ],
    "message": "string",
    "quota": {
      "id": "string",
      "inFlight": 0,
      "kind": "allocation",
      "limit": 0,
      "periodStart": "2019-08-24T14:15:22Z",
      "region": "string",
      "resetsAt": "2019-08-24T14:15:22Z",
      "scope": "organization",
      "scopeResourceName": "string",
      "used": 0,
      "window": "string"
    }
  }
}
```

- `DeleteSegment.response.409.error` (object, required)
  - `DeleteSegment.response.409.error.code` (string, required)
    - maxLength 64; pattern `^[a-z][a-z0-9_]*$`
  - `DeleteSegment.response.409.error.message` (string, required)
    - maxLength 1024
  - `DeleteSegment.response.409.error.issues` (array<object>, optional) — invalid_request: one entry per problem, at a dotted path.
    - `DeleteSegment.response.409.error.issues.message` (string, required)
    - `DeleteSegment.response.409.error.issues.path` (string, required)
  - `DeleteSegment.response.409.error.quota` (object, optional) — quota_exceeded: the quota that refused the request. Never with Retry-After.
    - `DeleteSegment.response.409.error.quota.id` (string, required)
    - `DeleteSegment.response.409.error.quota.kind` (unknown, required)
      - one of `"allocation"`, `"rate"`, `"usage"`, `"concurrency"`
    - `DeleteSegment.response.409.error.quota.limit` (integer, required)
      - min 0
    - `DeleteSegment.response.409.error.quota.scope` (unknown, required)
      - one of `"organization"`, `"project"`, `"resource"`
    - `DeleteSegment.response.409.error.quota.inFlight` (integer, optional)
      - min 0
    - `DeleteSegment.response.409.error.quota.periodStart` (string, optional)
      - format `date-time`
    - `DeleteSegment.response.409.error.quota.region` (string, optional)
    - `DeleteSegment.response.409.error.quota.resetsAt` (string, optional)
      - format `date-time`
    - `DeleteSegment.response.409.error.quota.scopeResourceName` (string, optional)
    - `DeleteSegment.response.409.error.quota.used` (integer, optional)
      - min 0
    - `DeleteSegment.response.409.error.quota.window` (string, optional) — rate only: an ISO 8601 duration, PT1S to PT1H.

### 412

precondition_failed: it changed since the If-Match ETag was read. Nothing was changed.

#### Example

```json
{
  "error": {
    "code": "string",
    "issues": [
      {
        "message": "string",
        "path": "string"
      }
    ],
    "message": "string",
    "quota": {
      "id": "string",
      "inFlight": 0,
      "kind": "allocation",
      "limit": 0,
      "periodStart": "2019-08-24T14:15:22Z",
      "region": "string",
      "resetsAt": "2019-08-24T14:15:22Z",
      "scope": "organization",
      "scopeResourceName": "string",
      "used": 0,
      "window": "string"
    }
  }
}
```

- `DeleteSegment.response.412.error` (object, required)
  - `DeleteSegment.response.412.error.code` (string, required)
    - maxLength 64; pattern `^[a-z][a-z0-9_]*$`
  - `DeleteSegment.response.412.error.message` (string, required)
    - maxLength 1024
  - `DeleteSegment.response.412.error.issues` (array<object>, optional) — invalid_request: one entry per problem, at a dotted path.
    - `DeleteSegment.response.412.error.issues.message` (string, required)
    - `DeleteSegment.response.412.error.issues.path` (string, required)
  - `DeleteSegment.response.412.error.quota` (object, optional) — quota_exceeded: the quota that refused the request. Never with Retry-After.
    - `DeleteSegment.response.412.error.quota.id` (string, required)
    - `DeleteSegment.response.412.error.quota.kind` (unknown, required)
      - one of `"allocation"`, `"rate"`, `"usage"`, `"concurrency"`
    - `DeleteSegment.response.412.error.quota.limit` (integer, required)
      - min 0
    - `DeleteSegment.response.412.error.quota.scope` (unknown, required)
      - one of `"organization"`, `"project"`, `"resource"`
    - `DeleteSegment.response.412.error.quota.inFlight` (integer, optional)
      - min 0
    - `DeleteSegment.response.412.error.quota.periodStart` (string, optional)
      - format `date-time`
    - `DeleteSegment.response.412.error.quota.region` (string, optional)
    - `DeleteSegment.response.412.error.quota.resetsAt` (string, optional)
      - format `date-time`
    - `DeleteSegment.response.412.error.quota.scopeResourceName` (string, optional)
    - `DeleteSegment.response.412.error.quota.used` (integer, optional)
      - min 0
    - `DeleteSegment.response.412.error.quota.window` (string, optional) — rate only: an ISO 8601 duration, PT1S to PT1H.

### 429

too_many_requests, with Retry-After; or quota_exceeded (a rate, usage or concurrency quota, with quota), never with Retry-After.

#### Example

```json
{
  "error": {
    "code": "string",
    "issues": [
      {
        "message": "string",
        "path": "string"
      }
    ],
    "message": "string",
    "quota": {
      "id": "string",
      "inFlight": 0,
      "kind": "allocation",
      "limit": 0,
      "periodStart": "2019-08-24T14:15:22Z",
      "region": "string",
      "resetsAt": "2019-08-24T14:15:22Z",
      "scope": "organization",
      "scopeResourceName": "string",
      "used": 0,
      "window": "string"
    }
  }
}
```

- `DeleteSegment.response.429.error` (object, required)
  - `DeleteSegment.response.429.error.code` (string, required)
    - maxLength 64; pattern `^[a-z][a-z0-9_]*$`
  - `DeleteSegment.response.429.error.message` (string, required)
    - maxLength 1024
  - `DeleteSegment.response.429.error.issues` (array<object>, optional) — invalid_request: one entry per problem, at a dotted path.
    - `DeleteSegment.response.429.error.issues.message` (string, required)
    - `DeleteSegment.response.429.error.issues.path` (string, required)
  - `DeleteSegment.response.429.error.quota` (object, optional) — quota_exceeded: the quota that refused the request. Never with Retry-After.
    - `DeleteSegment.response.429.error.quota.id` (string, required)
    - `DeleteSegment.response.429.error.quota.kind` (unknown, required)
      - one of `"allocation"`, `"rate"`, `"usage"`, `"concurrency"`
    - `DeleteSegment.response.429.error.quota.limit` (integer, required)
      - min 0
    - `DeleteSegment.response.429.error.quota.scope` (unknown, required)
      - one of `"organization"`, `"project"`, `"resource"`
    - `DeleteSegment.response.429.error.quota.inFlight` (integer, optional)
      - min 0
    - `DeleteSegment.response.429.error.quota.periodStart` (string, optional)
      - format `date-time`
    - `DeleteSegment.response.429.error.quota.region` (string, optional)
    - `DeleteSegment.response.429.error.quota.resetsAt` (string, optional)
      - format `date-time`
    - `DeleteSegment.response.429.error.quota.scopeResourceName` (string, optional)
    - `DeleteSegment.response.429.error.quota.used` (integer, optional)
      - min 0
    - `DeleteSegment.response.429.error.quota.window` (string, optional) — rate only: an ISO 8601 duration, PT1S to PT1H.

### 500

internal_error: a bug; the details are in the logs, under the request ID.

#### Example

```json
{
  "error": {
    "code": "string",
    "issues": [
      {
        "message": "string",
        "path": "string"
      }
    ],
    "message": "string",
    "quota": {
      "id": "string",
      "inFlight": 0,
      "kind": "allocation",
      "limit": 0,
      "periodStart": "2019-08-24T14:15:22Z",
      "region": "string",
      "resetsAt": "2019-08-24T14:15:22Z",
      "scope": "organization",
      "scopeResourceName": "string",
      "used": 0,
      "window": "string"
    }
  }
}
```

- `DeleteSegment.response.500.error` (object, required)
  - `DeleteSegment.response.500.error.code` (string, required)
    - maxLength 64; pattern `^[a-z][a-z0-9_]*$`
  - `DeleteSegment.response.500.error.message` (string, required)
    - maxLength 1024
  - `DeleteSegment.response.500.error.issues` (array<object>, optional) — invalid_request: one entry per problem, at a dotted path.
    - `DeleteSegment.response.500.error.issues.message` (string, required)
    - `DeleteSegment.response.500.error.issues.path` (string, required)
  - `DeleteSegment.response.500.error.quota` (object, optional) — quota_exceeded: the quota that refused the request. Never with Retry-After.
    - `DeleteSegment.response.500.error.quota.id` (string, required)
    - `DeleteSegment.response.500.error.quota.kind` (unknown, required)
      - one of `"allocation"`, `"rate"`, `"usage"`, `"concurrency"`
    - `DeleteSegment.response.500.error.quota.limit` (integer, required)
      - min 0
    - `DeleteSegment.response.500.error.quota.scope` (unknown, required)
      - one of `"organization"`, `"project"`, `"resource"`
    - `DeleteSegment.response.500.error.quota.inFlight` (integer, optional)
      - min 0
    - `DeleteSegment.response.500.error.quota.periodStart` (string, optional)
      - format `date-time`
    - `DeleteSegment.response.500.error.quota.region` (string, optional)
    - `DeleteSegment.response.500.error.quota.resetsAt` (string, optional)
      - format `date-time`
    - `DeleteSegment.response.500.error.quota.scopeResourceName` (string, optional)
    - `DeleteSegment.response.500.error.quota.used` (integer, optional)
      - min 0
    - `DeleteSegment.response.500.error.quota.window` (string, optional) — rate only: an ISO 8601 duration, PT1S to PT1H.

### 503

unavailable: a dependency the request needs is down. Retry after Retry-After.

#### Example

```json
{
  "error": {
    "code": "string",
    "issues": [
      {
        "message": "string",
        "path": "string"
      }
    ],
    "message": "string",
    "quota": {
      "id": "string",
      "inFlight": 0,
      "kind": "allocation",
      "limit": 0,
      "periodStart": "2019-08-24T14:15:22Z",
      "region": "string",
      "resetsAt": "2019-08-24T14:15:22Z",
      "scope": "organization",
      "scopeResourceName": "string",
      "used": 0,
      "window": "string"
    }
  }
}
```

- `DeleteSegment.response.503.error` (object, required)
  - `DeleteSegment.response.503.error.code` (string, required)
    - maxLength 64; pattern `^[a-z][a-z0-9_]*$`
  - `DeleteSegment.response.503.error.message` (string, required)
    - maxLength 1024
  - `DeleteSegment.response.503.error.issues` (array<object>, optional) — invalid_request: one entry per problem, at a dotted path.
    - `DeleteSegment.response.503.error.issues.message` (string, required)
    - `DeleteSegment.response.503.error.issues.path` (string, required)
  - `DeleteSegment.response.503.error.quota` (object, optional) — quota_exceeded: the quota that refused the request. Never with Retry-After.
    - `DeleteSegment.response.503.error.quota.id` (string, required)
    - `DeleteSegment.response.503.error.quota.kind` (unknown, required)
      - one of `"allocation"`, `"rate"`, `"usage"`, `"concurrency"`
    - `DeleteSegment.response.503.error.quota.limit` (integer, required)
      - min 0
    - `DeleteSegment.response.503.error.quota.scope` (unknown, required)
      - one of `"organization"`, `"project"`, `"resource"`
    - `DeleteSegment.response.503.error.quota.inFlight` (integer, optional)
      - min 0
    - `DeleteSegment.response.503.error.quota.periodStart` (string, optional)
      - format `date-time`
    - `DeleteSegment.response.503.error.quota.region` (string, optional)
    - `DeleteSegment.response.503.error.quota.resetsAt` (string, optional)
      - format `date-time`
    - `DeleteSegment.response.503.error.quota.scopeResourceName` (string, optional)
    - `DeleteSegment.response.503.error.quota.used` (integer, optional)
      - min 0
    - `DeleteSegment.response.503.error.quota.window` (string, optional) — rate only: an ISO 8601 duration, PT1S to PT1H.


Source: https://docs.ezghcloud.com/flags-api/DeleteSegment/index.md
