---
title: "Search for attachments based on criteria provided"
url: "https://developers.vzconnect.com/apis/fleet-inspections-api/versions/e4689b0c-c26d-40d6-b023-5303083c4a3f/operations/attachments-search"
---

> Full API specification: https://developers.vzconnect.com/apis/fleet-inspections-api/versions/e4689b0c-c26d-40d6-b023-5303083c4a3f.md

# Search for attachments based on criteria provided

`POST` `/inspections/attachments/search`

Operation ID: `attachments-search`

Returns a list of attachments based on criteria provided.

## Request body

Content types: `application/json`

## Responses

- `200` - Ok
- `400` - Bad Request
- `401` - Unauthorized
- `403` - Forbidden
- `429` - Too Many Requests
- `default` - Internal Server Error

## OpenAPI definition

```yaml
openapi: 3.0.0
info:
  title: Fleet Inspections API
  version: "1.0"
servers:
  - url: https://api.us.vzconnect.com
paths:
  /inspections/attachments/search:
    post:
      tags:
        - Fleet Inspections API
      summary: Search for attachments based on criteria provided
      description: Returns a list of attachments based on criteria provided.
      operationId: attachments-search
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AttachmentSearch"
            examples:
              Search by attachment IDs:
                value:
                  conditions:
                    - operator: IN
                      field: attachmentId
                      values:
                        - XJY7KZ9LmNp4QW8R
                        - YTR9KZ8LmNp5QW9S
                  fields:
                    - attachmentId
                    - name
                    - attachmentType
                    - author
      responses:
        "200":
          description: Ok
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    maxItems: 100
                    minItems: 0
                    uniqueItems: true
                    type: array
                    description: A list of attachments matching the criteria provided.
                    items:
                      $ref: "#/components/schemas/Attachment"
                additionalProperties: false
              examples:
                Found attachments:
                  value:
                    items:
                      - data:
                          - rel: enclosure
                            href: https://vzc.local/5drhSHbcyEMDBDRG
                            method: GET
                            length: 954354
                            tags:
                              - original
                          - rel: enclosure
                            href: https://vzc.local/Kg2YtnLsdH8RmESJ
                            method: GET
                            length: 87432
                            tags:
                              - thumbnail328
                          - rel: enclosure
                            href: https://vzc.local/X251yHs16ZbpyeS2
                            method: GET
                            length: 48945
                            tags:
                              - thumbnail280
                        name: Signing report
                        links:
                          - method: GET
                            rel: self
                            href: /attachments/XJY7KZ9LmNp4QW8R
                        author:
                          name: John Doe
                          authorId: DtfckZgFzLwGaU93
                          authorType: OPERATOR
                        attachmentType: PHOTO
                        attachmentId: XJY7KZ9LmNp4QW8R
                      - data:
                          - rel: enclosure
                            href: https://vzc.local/5drhSHbcyEMDBDRG
                            method: GET
                            length: 954354
                            tags:
                              - original
                          - rel: enclosure
                            href: https://vzc.local/Kg2YtnLsdH8RmESJ
                            method: GET
                            length: 87432
                            tags:
                              - thumbnail328
                          - rel: enclosure
                            href: https://vzc.local/X251yHs16ZbpyeS2
                            method: GET
                            length: 48945
                            tags:
                              - thumbnail280
                        name: Signing report
                        links:
                          - method: GET
                            rel: self
                            href: /attachments/YTR9KZ8LmNp5QW9S
                        author:
                          name: John Doe
                          authorId: GdUjjWFYbeLnC4YL
                          authorType: OPERATOR
                        attachmentType: PHOTO
                        attachmentId: YTR9KZ8LmNp5QW9S
                Nothing found:
                  value:
                    items: []
        "400":
          $ref: "#/components/responses/BadRequest"
          description: Bad request. The request is not valid.
        "401":
          $ref: "#/components/responses/Unauthorized"
          description: Unauthorized. The authorization token is missing or not valid.
        "403":
          $ref: "#/components/responses/Forbidden"
          description: Forbidden. The caller is not allowed to access this resource.
        "429":
          $ref: "#/components/responses/TooManyRequests"
          description: Too many requests. The rate limit has been exceeded.
        default:
          $ref: "#/components/responses/InternalServerError"
          description: An unexpected error occurred.
      deprecated: false
      x-kong-route-defaults:
        strip_path: false
        paths:
          - ~/inspections/attachments/search/?$
components:
  schemas:
    AttachmentSearch:
      title: AttachmentSearch
      required:
        - conditions
        - fields
      type: object
      properties:
        conditions:
          maxItems: 100
          minItems: 1
          type: array
          description: Group of conditions to filter by the resource representation.
          items:
            required:
              - field
              - operator
              - values
            type: object
            properties:
              operator:
                type: string
                description: Operator to use to compare between property values and a defined
                  set of values.
                enum:
                  - IN
              field:
                maxLength: 120
                minLength: 1
                pattern: ^(attachmentId)$
                type: string
                description: Name of the property to be evaluated.
              values:
                maxItems: 100
                minItems: 1
                type: array
                description: Values to evaluate.
                items:
                  maxLength: 120
                  minLength: 1
                  pattern: ^[^\n]*$
                  type: string
                  description: Value to evaluate.
        fields:
          maxItems: 8
          minItems: 1
          type: array
          description: Resource properties to return as resource representations. Returns
            only provided properties of the resource representation.
          items:
            maxLength: 120
            minLength: 1
            pattern: ^(attachmentId|name|attachmentType|createdAt|author|comment|links|data)$
            type: string
            description: Field or property name to be returned in the resource
              representation.
      additionalProperties: false
      description: Schema for searching attachments based on attachment IDs.
    Attachment:
      title: Attachment
      required:
        - attachmentType
        - author
      type: object
      properties:
        data:
          maxItems: 100
          minItems: 0
          uniqueItems: true
          type: array
          description: Various media for an attachment
          readOnly: true
          items:
            type: object
            properties:
              rel:
                maxLength: 120
                minLength: 1
                pattern: ^(enclosure)$
                type: string
                description: |
                  Meaning of the values [described at IANA](https://www.iana.org/assignments/link-relations/link-relations.xhtml)
                    - *enclosure* - media, typically photo or document related to the resource, potentially large and might require special handling
              href:
                maxLength: 2000
                minLength: 1
                pattern: ^[^\n]+$
                type: string
                description: URL of relevant data
                format: uri
              method:
                type: string
                description: HTTP method to interact with data
                enum:
                  - GET
                  - PUT
              length:
                maximum: 6291456
                minimum: 1
                type: integer
                description: Size of a data referenced in *href* in bytes
                format: int32
              tags:
                maxItems: 100
                minItems: 0
                uniqueItems: true
                type: array
                description: Labels and attributes of a data enclosure
                readOnly: true
                items:
                  maxLength: 120
                  minLength: 1
                  pattern: ^[a-z0-9]+$
                  type: string
                  description: Individual label or attribute of a data enclosure
                  readOnly: true
            additionalProperties: false
        name:
          maxLength: 120
          minLength: 1
          pattern: ^[^\n]+$
          type: string
          description: Name of an attachment.
          nullable: true
        comment:
          maxLength: 2000
          minLength: 0
          pattern: ^[^\n]*$
          type: string
          description: Attachment details
          nullable: true
        enclosure:
          required:
            - contentLength
            - contentType
          type: object
          properties:
            contentLength:
              maximum: 6291456
              minimum: 1
              type: integer
              description: Size of media in bytes
              format: int32
            contentType:
              maxLength: 120
              minLength: 3
              pattern: ^(image\/jpeg|image\/png)$
              type: string
              description: Media type specifying format of the contents. See [RFC
                9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-content-type)
                for details
          additionalProperties: false
          description: Related media, typically photo or document, potentially large and
            thus requiring separate upload facility
          writeOnly: true
        attachmentId:
          maxLength: 120
          minLength: 1
          pattern: ^[A-Za-z0-9-]{1,120}$
          type: string
          description: Unique identifier of an attachment.
          readOnly: true
        author:
          required:
            - authorType
          type: object
          properties:
            name:
              maxLength: 120
              minLength: 1
              pattern: ^[^\n]+$
              type: string
              description: Name of the author created an attachment.
              readOnly: true
            authorId:
              maxLength: 120
              minLength: 1
              pattern: ^[A-Za-z0-9-]{1,120}$
              type: string
              description: Unique identifier of the author created an attachment.
              readOnly: true
            authorType:
              type: string
              description: Person that created an attachment
              enum:
                - OPERATOR
                - COMPLIANCE_MANAGER
          additionalProperties: false
          description: Person that created an attachment
        attachmentType:
          $ref: "#/components/schemas/AttachmentType"
        links:
          maxItems: 100
          minItems: 0
          uniqueItems: true
          type: array
          description: Related resources
          readOnly: true
          items:
            $ref: "#/components/schemas/Link"
      additionalProperties: true
      description: |
        Inspection attachment: photo, signature, document, comment.

        *name* would be used as file name if enclosure is uploaded.
    AttachmentType:
      type: string
      description: Type of attachment, example Signature, Comment, Photo
      enum:
        - SIGNATURE
        - COMMENT
        - PHOTO
    Link:
      title: Link
      required:
        - href
        - rel
      type: object
      properties:
        rel:
          maxLength: 10
          minLength: 4
          pattern: ^(appendix|next|prev|self)$
          type: string
          description: |
            Meaning of the values [described at IANA](https://www.iana.org/assignments/link-relations/link-relations.xhtml)
              - *appendix* - refers to documents serving as an appendix to the current resource
              - *next* - context is a part of a series, and that the next in the series is the link target
              - *prev* - context is a part of a series, and that the previous in the series is the link target
              - *self* - URI of a resource or current page of the collection
        method:
          type: string
          description: HTTP method to interact with linked resource
          enum:
            - GET
            - PUT
        title:
          maxLength: 120
          minLength: 1
          pattern: ^[^\n]+$
          type: string
          description: Relation type with the target resource as human-readable text
        href:
          maxLength: 2000
          minLength: 1
          pattern: ^[^\n]+$
          type: string
          description: URL of linked resource
          format: uri-reference
      additionalProperties: false
      description: Reference to another resource
    ProblemJson:
      title: ProblemJson
      type: object
      properties:
        type:
          maxLength: 2000
          minLength: 0
          pattern: ^[^\n]*$
          type: string
          description: A URI reference that identifies the problem type.
          format: uri
        detail:
          maxLength: 2000
          minLength: 0
          pattern: ^[^\n]*$
          type: string
          description: A human-readable explanation specific to this occurrence of the
            problem.
        status:
          maximum: 599
          minimum: 300
          type: integer
          description: The HTTP status code generated by the origin server for this
            occurrence of the problem.
          format: int32
        errors:
          maxItems: 120
          minItems: 1
          uniqueItems: true
          type: array
          description: An extension that contains a list of individual error occurrences
            found, with details and a pointer to the location of each. Use this
            extension to convey more than one errors of the same type.
          items:
            type: object
            properties:
              debugId:
                maxLength: 120
                minLength: 0
                pattern: ^[^\n]*$
                type: string
                description: A unique error identifier string generated on the service-side and
                  logged for correlation purposes.
              pointer:
                maxLength: 120
                minLength: 0
                pattern: ^(\/[^\n]+)*$
                type: string
                description: A pointer to locate the problem within the request's content using
                  a [JSON Pointer](https://www.rfc-editor.org/info/rfc6901).
                  This extension is only applicable in case of 4xx range of
                  errors.
              detail:
                maxLength: 2000
                minLength: 0
                pattern: ^[^\n]*$
                type: string
                description: A human-readable explanation specific to this occurrence of the
                  problem.
            additionalProperties: false
        instance:
          maxLength: 2000
          minLength: 0
          pattern: ^[^\n]*$
          type: string
          description: A URI reference that identifies the specific occurrence of the
            problem. It may or may not yield further information if
            dereferenced.
          format: uri
        debugId:
          maxLength: 120
          minLength: 0
          pattern: ^[^\n]*$
          type: string
          description: A unique error identifier string generated on the service-side and
            logged for correlation purposes.
        pointer:
          maxLength: 120
          minLength: 0
          pattern: ^(\/[^\n]+)*$
          type: string
          description: A pointer to locate the problem within the request's content using
            a [JSON Pointer](https://www.rfc-editor.org/info/rfc6901). This
            extension is only applicable in case of 4xx range of errors.
        title:
          maxLength: 2000
          minLength: 0
          pattern: ^[^\n]*$
          type: string
          description: A short, human-readable summary of the problem type.
      additionalProperties: false
      description: JSON Schema for HTTP Problems as defined by RFC 9457
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/ProblemJson"
    Unauthorized:
      description: Unauthorized
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/ProblemJson"
    Forbidden:
      description: Forbidden
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/ProblemJson"
    TooManyRequests:
      description: Too Many Requests
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/ProblemJson"
    InternalServerError:
      description: Internal Server Error
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/ProblemJson"
```
