> ## Documentation Index
> Fetch the complete documentation index at: https://developer.buildpass.global/llms.txt
> Use this file to discover all available pages before exploring further.

# Upload attachment

> Upload one attachment file and receive an attachment reference for a later resource create request. Include type=attachment so BuildPass can route the file to the correct storage family. For example, use the returned reference to create a photo.

Requires a valid authenticated request for the builder. No resource-specific scope is required for upload.

Uploads one attachment file into BuildPass-managed attachment storage and returns an attachment reference.

Include `type=attachment` in the multipart body. The `type` tells BuildPass which storage family to use; `attachment` is the only externally supported upload type for now.

For example, you can use the returned `{ key, regionId, type }` to create a photo by passing it as `imageAttachment`.


## OpenAPI

````yaml POST /builders/{builderId}/attachments/upload
openapi: 3.0.0
info:
  title: BuildPass API
  description: >-
    Approved integrators can connect to the BuildPass API on behalf of builders
    to build connections between a wide range of construction platforms.
  version: 1.0.0
servers:
  - url: https://api.buildpass.global
    description: Production server
security:
  - OAuth2: []
paths:
  /builders/{builderId}/attachments/upload:
    post:
      tags:
        - Attachments
      summary: Upload attachment
      description: >-
        Upload one attachment file and receive an attachment reference for a
        later resource create request. Include type=attachment so BuildPass can
        route the file to the correct storage family. For example, use the
        returned reference to create a photo.
      parameters:
        - name: builderId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
                - type
              properties:
                file:
                  type: string
                  format: binary
                type:
                  type: string
                  enum:
                    - attachment
      responses:
        '201':
          description: Attachment uploaded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AttachmentUploadResponse'
      security:
        - OAuth2: []
components:
  schemas:
    AttachmentUploadResponse:
      allOf:
        - $ref: '#/components/schemas/AttachmentUploadReference'
        - type: object
          properties:
            imageUrl:
              type: string
              format: uri
            fileName:
              type: string
            contentType:
              type: string
            fieldName:
              type: string
              description: Present on bulk upload responses.
    AttachmentUploadReference:
      type: object
      required:
        - key
        - type
      properties:
        key:
          type: string
          example: external-uploads/ckbuilder123456789012345678/photo.jpg
        regionId:
          type: string
          nullable: true
          example: au1
        type:
          type: string
          enum:
            - attachment
  securitySchemes:
    OAuth2:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://api.buildpass.global/oauth/token
          scopes:
            read:subcontractors: Read subcontractors
            write:subcontractors: Write subcontractors
            read:prequalifications: Read prequalifications
            write:prequalifications: Write prequalifications
            read:insurances: Read insurances
            write:insurances: Write insurances
            read:contacts: Read contacts
            read:swms: Read SWMS
            read:timesheets: Read timesheets
            read:inductions: Read inductions
            read:meetings: Read meetings
            write:meetings: Write meetings
            read:photos: Read photos and photo folders
            write:photos: Create, update, delete, and sync photos and photo folders

````