---
title: "Node Has Attachment"
description: "Verify if a node has a specified attachment with optional content type using the nodeHasAttachment condition. (Gitana 4.0)"
product: "Gitana"
version: "4.0"
url: "/documentation/gitana/4.0/engine/behaviors/conditions/node-has-attachment"
---

# Node Has Attachment

The `nodeHasAttachment` condition tests whether a node has an attachment with a given `attachmentId` and optional `contentType`. It triggers if a matching attachment is found.

## JSON Schema

```
{
    "title": "Node Has Attachment",
    "properties": {
        "attachmentId": {
            "type": "string",
            "title": "Attachment ID",
            "default": "default"
        },
        "contentType": {
            "type": "string",
            "title": "Content Type"
        }
    }
}
```

## Example #1

Suppose you wanted to test whether a node has an attachment named `default` on it. You could set up the condition like this:

```
{
    "type": "nodeHasAttachment",
    "config": {
        "attachmentId": "default"
    }
}
```

## Example #2

Suppose you wanted to test whether a node has an attachment named `default` on it that has MIME type `image/jpeg`. You could set up the condition like this:

```
{
    "type": "nodeHasAttachment",
    "config": {
        "attachmentId": "default",
        "contentType": "image/jpeg"
    }
}
```
