# Delete vision images

Content Enrichment API / Vision AI

`POST https://api.ygo.ai/v2/project/content/vision/deleteImages`

Delete images this project submitted, by image ID.

Synchronous. A delete removes your access, not the picture or its analysis; other clients keep the image.

- Requires an org admin's or owner's user token; a project API key gets 403.
- 1 to 100 image IDs per request; one entry per ID, in request order.
- `Status` is `deleted` or `not_found`; an ID you do not own reports `not_found`.
- Idempotent: an already deleted image answers `deleted` again.
- The image leaves `listImages`, `getImages` and your `getEnrichedHotel` gallery, and its pin is cleared.
- Submitting the URL again restores it under the same image ID, unbilled.
- 404 means Vision AI is not enabled for your project.

Exact spec (OpenAPI 3.0, JSON): https://docs.ygo.ai/reference/deleteVisionImages.json

## Example request

```bash
curl -X POST 'https://api.ygo.ai/v2/project/content/vision/deleteImages' \
  -H "Authorization: Bearer $YGO_API_KEY" \
  -H "X-Project-ID: $YGO_PROJECT_ID" \
  -H "Content-Type: application/json" \
  -d '{
  "ImageIDs": [
    "0192fb20-1aa2-7def-9abc-1122334455aa",
    "0192fb21-2bb3-7def-9abc-2233445566bb"
  ]
}'
```

## Authorization

`Authorization: Bearer <key>`

User token (user_...) of an org admin or owner. Project-scoped API keys (proj_...) are refused with 403.

## Headers

- `X-Project-ID` (string (uuid), **required**)

  Project UUID. Required for all project-scoped endpoints.

  Example: `$YGO_PROJECT_ID`

## Request body

Required.

### application/json

Schema: object, `DeleteVisionImagesRequest`

Request body for deleting images this project submitted, by image ID.

- `ImageIDs` (array of string (uuid), **required**)

  Image UUIDs returned by ingestVisionImages, between 1 and 100 per request. The response returns one entry per ID, in this order.

  Example:

  ```json
  [
    "0192fb20-1aa2-7def-9abc-1122334455aa",
    "0192fb21-2bb3-7def-9abc-2233445566bb"
  ]
  ```

  Limits: min items 1, max items 100

#### Example request: twoImages. Delete two images you uploaded

```json
{
  "ImageIDs": [
    "0192fb20-1aa2-7def-9abc-1122334455aa",
    "0192fb21-2bb3-7def-9abc-2233445566bb"
  ]
}
```

#### Example request: oneNotOwned. One of your images and one ID this project never submitted

```json
{
  "ImageIDs": [
    "0192fb20-1aa2-7def-9abc-1122334455aa",
    "0192fb99-9ff9-7def-9abc-999999999999"
  ]
}
```

## Responses

### 200 OK

One entry per requested image ID, in request order. A batch in which every ID answers not_found is still a 200.

Headers:

- `X-Trace-ID` (string)

  Request trace ID for debugging (OpenTelemetry). Include this ID when contacting support about specific requests.

  Example: `abc123def456ghi789`

#### application/json

Schema: object, `DeleteVisionImagesResponse`

Standard v2 envelope. Data is an object carrying the per-image results; there is no pagination on this endpoint.

- `Data` (object, `DeleteVisionImagesResult`)

  - `Images` (array of object, `DeletedVisionImageState`, **required**)

    One entry per requested image ID, in request order.

    Each item: The verdict for one requested image ID. The entry carries no other field in either case, so a not_found entry is indistinguishable in shape from a deleted one.

    - `ImageID` (string (uuid), **required**)

      Echoes the requested image ID.

      Example: `0192fb20-1aa2-7def-9abc-1122334455aa`
    - `Status` (string, **required**)

      `deleted`: this project's image is now deleted, or already was. `not_found`: the ID is unknown, belongs to another client or is not a Vision AI image, and these cases are indistinguishable.

      Values: `deleted`, `not_found`

##### Example: allDeleted. Both images were this project's and are now deleted

```json
{
  "Data": {
    "Images": [
      {
        "ImageID": "0192fb20-1aa2-7def-9abc-1122334455aa",
        "Status": "deleted"
      },
      {
        "ImageID": "0192fb21-2bb3-7def-9abc-2233445566bb",
        "Status": "deleted"
      }
    ]
  }
}
```

##### Example: mixed. One deleted, one ID this project does not own

```json
{
  "Data": {
    "Images": [
      {
        "ImageID": "0192fb20-1aa2-7def-9abc-1122334455aa",
        "Status": "deleted"
      },
      {
        "ImageID": "0192fb99-9ff9-7def-9abc-999999999999",
        "Status": "not_found"
      }
    ]
  }
}
```

##### Example: repeatCall. The same call again: an already-deleted image still answers deleted

```json
{
  "Data": {
    "Images": [
      {
        "ImageID": "0192fb20-1aa2-7def-9abc-1122334455aa",
        "Status": "deleted"
      }
    ]
  }
}
```

### 400 Bad Request

Bad Request: the request body or an image ID is invalid.

Headers:

- `X-Trace-ID` (string)

  Request trace ID for debugging (OpenTelemetry). Include this ID when contacting support about specific requests.

  Example: `abc123def456ghi789`

#### application/json

Schema: object, `ErrorResponse`

Standard v2 error response wrapper.

- `Error` (object, `ErrorDetail`, **required**)

  Error detail containing a machine-readable code and human-readable message.

  - `Code` (string, **required**)

    Machine-readable error code for programmatic handling.

    Example: `VALIDATION_ERROR`
  - `Message` (string, **required**)

    Human-readable error message.

    Example: `Validation failed`
  - `Fields` (array of object, `FieldError`)

    Field-level validation errors. Only present for VALIDATION_ERROR responses.

    Each item: A single field-level validation error.

    - `Field` (string, **required**)

      Name of the field that failed validation. Per-entry errors carry the entry's position, for example ImageIDs[2].

      Example: `ImageIDs[2]`
    - `Message` (string, **required**)

      Human-readable validation error message for this field.

      Example: `ImageID must be a valid UUID`
    - `Code` (string)

      Machine-readable reason the field failed validation. Optional; clients should fall back to Message when it is absent or unrecognized.

      Values: `REQUIRED`, `TOO_LONG`, `TOO_SHORT`, `OUT_OF_RANGE`, `TOO_MANY`, `INVALID_FORMAT`, `NOT_ALLOWED`, `CONFLICT`, `INVALID_ENCODING`, `INSECURE_SCHEME`, `UNSAFE_CONTENT`, `REQUIRED_WHEN_ENABLED`

      Example: `TOO_LONG`
    - `Params` (map of string to any)

      Machine-readable values the message is built from, such as limits or allowed values; keys are PascalCase and depend on Code. Optional.

      Example:

      ```json
      {
        "Max": 100
      }
      ```

##### Example: emptyImageIDs. No image IDs provided

```json
{
  "Error": {
    "Code": "VALIDATION_ERROR",
    "Message": "Validation failed",
    "Fields": [
      {
        "Field": "ImageIDs",
        "Message": "ImageIDs must contain at least one image id"
      }
    ]
  }
}
```

##### Example: tooManyImageIDs. More than 100 image IDs in one request

```json
{
  "Error": {
    "Code": "VALIDATION_ERROR",
    "Message": "Validation failed",
    "Fields": [
      {
        "Field": "ImageIDs",
        "Message": "ImageIDs cannot exceed 100 entries"
      }
    ]
  }
}
```

##### Example: malformedImageID. An entry is not a valid UUID

```json
{
  "Error": {
    "Code": "VALIDATION_ERROR",
    "Message": "Validation failed",
    "Fields": [
      {
        "Field": "ImageIDs[2]",
        "Message": "ImageID must be a valid UUID"
      }
    ]
  }
}
```

### 401 Unauthorized

Unauthorized: the user token is missing or invalid.

Headers:

- `X-Trace-ID` (string)

  Request trace ID for debugging (OpenTelemetry). Include this ID when contacting support about specific requests.

  Example: `abc123def456ghi789`

#### application/json

Schema: object, `ErrorResponse`

Standard v2 error response wrapper.

- `Error` (object, `ErrorDetail`, **required**)

  Error detail containing a machine-readable code and human-readable message.

  - `Code` (string, **required**)

    Machine-readable error code for programmatic handling.

    Example: `VALIDATION_ERROR`
  - `Message` (string, **required**)

    Human-readable error message.

    Example: `Validation failed`
  - `Fields` (array of object, `FieldError`)

    Field-level validation errors. Only present for VALIDATION_ERROR responses.

    Each item: A single field-level validation error.

    - `Field` (string, **required**)

      Name of the field that failed validation. Per-entry errors carry the entry's position, for example ImageIDs[2].

      Example: `ImageIDs[2]`
    - `Message` (string, **required**)

      Human-readable validation error message for this field.

      Example: `ImageID must be a valid UUID`
    - `Code` (string)

      Machine-readable reason the field failed validation. Optional; clients should fall back to Message when it is absent or unrecognized.

      Values: `REQUIRED`, `TOO_LONG`, `TOO_SHORT`, `OUT_OF_RANGE`, `TOO_MANY`, `INVALID_FORMAT`, `NOT_ALLOWED`, `CONFLICT`, `INVALID_ENCODING`, `INSECURE_SCHEME`, `UNSAFE_CONTENT`, `REQUIRED_WHEN_ENABLED`

      Example: `TOO_LONG`
    - `Params` (map of string to any)

      Machine-readable values the message is built from, such as limits or allowed values; keys are PascalCase and depend on Code. Optional.

      Example:

      ```json
      {
        "Max": 100
      }
      ```

##### Example: invalidKey. Invalid API key

```json
{
  "Error": {
    "Code": "UNAUTHORIZED",
    "Message": "Invalid API key"
  }
}
```

### 403 Forbidden

Forbidden: the token is a project API key, its user is below org admin, it may not act on this project, or it lacks the `content.catalog:write` permission (`INSUFFICIENT_SCOPE`).

Headers:

- `X-Trace-ID` (string)

  Request trace ID for debugging (OpenTelemetry). Include this ID when contacting support about specific requests.

  Example: `abc123def456ghi789`

#### application/json

Schema: object, `ErrorResponse`

Standard v2 error response wrapper.

- `Error` (object, `ErrorDetail`, **required**)

  Error detail containing a machine-readable code and human-readable message.

  - `Code` (string, **required**)

    Machine-readable error code for programmatic handling.

    Example: `VALIDATION_ERROR`
  - `Message` (string, **required**)

    Human-readable error message.

    Example: `Validation failed`
  - `Fields` (array of object, `FieldError`)

    Field-level validation errors. Only present for VALIDATION_ERROR responses.

    Each item: A single field-level validation error.

    - `Field` (string, **required**)

      Name of the field that failed validation. Per-entry errors carry the entry's position, for example ImageIDs[2].

      Example: `ImageIDs[2]`
    - `Message` (string, **required**)

      Human-readable validation error message for this field.

      Example: `ImageID must be a valid UUID`
    - `Code` (string)

      Machine-readable reason the field failed validation. Optional; clients should fall back to Message when it is absent or unrecognized.

      Values: `REQUIRED`, `TOO_LONG`, `TOO_SHORT`, `OUT_OF_RANGE`, `TOO_MANY`, `INVALID_FORMAT`, `NOT_ALLOWED`, `CONFLICT`, `INVALID_ENCODING`, `INSECURE_SCHEME`, `UNSAFE_CONTENT`, `REQUIRED_WHEN_ENABLED`

      Example: `TOO_LONG`
    - `Params` (map of string to any)

      Machine-readable values the message is built from, such as limits or allowed values; keys are PascalCase and depend on Code. Optional.

      Example:

      ```json
      {
        "Max": 100
      }
      ```

##### Example: insufficientScope. Missing required scope

```json
{
  "Error": {
    "Code": "INSUFFICIENT_SCOPE",
    "Message": "token lacks scope content.catalog:write"
  }
}
```

##### Example: noProjectAccess. Project access required

```json
{
  "Error": {
    "Code": "FORBIDDEN",
    "Message": "Project access required"
  }
}
```

##### Example: roleRequired. A project (proj_) token or a user below org admin, the most common refusal

```json
{
  "Error": {
    "Code": "FORBIDDEN",
    "Message": "Deleting images requires a user token with the org admin role or higher"
  }
}
```

### 404 Not Found

Not Found: Vision AI is not enabled for your project, or the project does not exist. An unknown image ID is not a 404; it is reported per image as `not_found`.

Headers:

- `X-Trace-ID` (string)

  Request trace ID for debugging (OpenTelemetry). Include this ID when contacting support about specific requests.

  Example: `abc123def456ghi789`

#### application/json

Schema: object, `ErrorResponse`

Standard v2 error response wrapper.

- `Error` (object, `ErrorDetail`, **required**)

  Error detail containing a machine-readable code and human-readable message.

  - `Code` (string, **required**)

    Machine-readable error code for programmatic handling.

    Example: `VALIDATION_ERROR`
  - `Message` (string, **required**)

    Human-readable error message.

    Example: `Validation failed`
  - `Fields` (array of object, `FieldError`)

    Field-level validation errors. Only present for VALIDATION_ERROR responses.

    Each item: A single field-level validation error.

    - `Field` (string, **required**)

      Name of the field that failed validation. Per-entry errors carry the entry's position, for example ImageIDs[2].

      Example: `ImageIDs[2]`
    - `Message` (string, **required**)

      Human-readable validation error message for this field.

      Example: `ImageID must be a valid UUID`
    - `Code` (string)

      Machine-readable reason the field failed validation. Optional; clients should fall back to Message when it is absent or unrecognized.

      Values: `REQUIRED`, `TOO_LONG`, `TOO_SHORT`, `OUT_OF_RANGE`, `TOO_MANY`, `INVALID_FORMAT`, `NOT_ALLOWED`, `CONFLICT`, `INVALID_ENCODING`, `INSECURE_SCHEME`, `UNSAFE_CONTENT`, `REQUIRED_WHEN_ENABLED`

      Example: `TOO_LONG`
    - `Params` (map of string to any)

      Machine-readable values the message is built from, such as limits or allowed values; keys are PascalCase and depend on Code. Optional.

      Example:

      ```json
      {
        "Max": 100
      }
      ```

##### Example: notFound. Project or resource not found

```json
{
  "Error": {
    "Code": "NOT_FOUND",
    "Message": "Not found"
  }
}
```

### 429 Too Many Requests

Too Many Requests: the rate limit was exceeded. `Retry-After` carries the number of seconds to wait before retrying.

Headers:

- `X-Trace-ID` (string)

  Request trace ID for debugging (OpenTelemetry). Include this ID when contacting support about specific requests.

  Example: `abc123def456ghi789`
- `Retry-After` (integer)

  Number of seconds to wait before retrying the request. Present on 429 responses.

  Example: `30`

  Limits: min 1

#### application/json

Schema: object, `ErrorResponse`

Standard v2 error response wrapper.

- `Error` (object, `ErrorDetail`, **required**)

  Error detail containing a machine-readable code and human-readable message.

  - `Code` (string, **required**)

    Machine-readable error code for programmatic handling.

    Example: `VALIDATION_ERROR`
  - `Message` (string, **required**)

    Human-readable error message.

    Example: `Validation failed`
  - `Fields` (array of object, `FieldError`)

    Field-level validation errors. Only present for VALIDATION_ERROR responses.

    Each item: A single field-level validation error.

    - `Field` (string, **required**)

      Name of the field that failed validation. Per-entry errors carry the entry's position, for example ImageIDs[2].

      Example: `ImageIDs[2]`
    - `Message` (string, **required**)

      Human-readable validation error message for this field.

      Example: `ImageID must be a valid UUID`
    - `Code` (string)

      Machine-readable reason the field failed validation. Optional; clients should fall back to Message when it is absent or unrecognized.

      Values: `REQUIRED`, `TOO_LONG`, `TOO_SHORT`, `OUT_OF_RANGE`, `TOO_MANY`, `INVALID_FORMAT`, `NOT_ALLOWED`, `CONFLICT`, `INVALID_ENCODING`, `INSECURE_SCHEME`, `UNSAFE_CONTENT`, `REQUIRED_WHEN_ENABLED`

      Example: `TOO_LONG`
    - `Params` (map of string to any)

      Machine-readable values the message is built from, such as limits or allowed values; keys are PascalCase and depend on Code. Optional.

      Example:

      ```json
      {
        "Max": 100
      }
      ```

##### Example: rateLimited. Limit exceeded

```json
{
  "Error": {
    "Code": "RATE_LIMIT_EXCEEDED",
    "Message": "Rate limit exceeded. Retry after the number of seconds in the Retry-After header."
  }
}
```

### 500 Internal Server Error

Internal Server Error: unexpected server error. Quote the `X-Trace-ID` response header when contacting support.

Headers:

- `X-Trace-ID` (string)

  Request trace ID for debugging (OpenTelemetry). Include this ID when contacting support about specific requests.

  Example: `abc123def456ghi789`

#### application/json

Schema: object, `ErrorResponse`

Standard v2 error response wrapper.

- `Error` (object, `ErrorDetail`, **required**)

  Error detail containing a machine-readable code and human-readable message.

  - `Code` (string, **required**)

    Machine-readable error code for programmatic handling.

    Example: `VALIDATION_ERROR`
  - `Message` (string, **required**)

    Human-readable error message.

    Example: `Validation failed`
  - `Fields` (array of object, `FieldError`)

    Field-level validation errors. Only present for VALIDATION_ERROR responses.

    Each item: A single field-level validation error.

    - `Field` (string, **required**)

      Name of the field that failed validation. Per-entry errors carry the entry's position, for example ImageIDs[2].

      Example: `ImageIDs[2]`
    - `Message` (string, **required**)

      Human-readable validation error message for this field.

      Example: `ImageID must be a valid UUID`
    - `Code` (string)

      Machine-readable reason the field failed validation. Optional; clients should fall back to Message when it is absent or unrecognized.

      Values: `REQUIRED`, `TOO_LONG`, `TOO_SHORT`, `OUT_OF_RANGE`, `TOO_MANY`, `INVALID_FORMAT`, `NOT_ALLOWED`, `CONFLICT`, `INVALID_ENCODING`, `INSECURE_SCHEME`, `UNSAFE_CONTENT`, `REQUIRED_WHEN_ENABLED`

      Example: `TOO_LONG`
    - `Params` (map of string to any)

      Machine-readable values the message is built from, such as limits or allowed values; keys are PascalCase and depend on Code. Optional.

      Example:

      ```json
      {
        "Max": 100
      }
      ```

##### Example: internalError. Internal server error

```json
{
  "Error": {
    "Code": "INTERNAL_ERROR",
    "Message": "Failed to delete images"
  }
}
```
