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

# Create a FileAttachment on a Job

> Create a `FileAttachment` related to an `Job`. Requires permission to create attachment on `Job`—`create_job_attachments`.

* If you're using a `DirectUpload` then you must use the `application/json` mime-type and `file` must be the `DirectUpload`'s `signed_id`
* If you're using a file then you must use the `multipart/form-data` mime-type and `file` must be a file.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/jobs/{job-id}/file_attachments
openapi: 3.0.3
info:
  title: Horizon API V1
  version: '1.0'
  contact:
    name: Tread
    url: https://tread.io
    email: developers@tread.io
  description: >-
    This is the Version 1 implementation.


    When in doubt we default to the practices outlined
    [here](https://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api#advanced-queries)
  license:
    name: Private
    url: https://tread.io
servers:
  - description: production
    url: https://api.tread-horizon.com
security:
  - bearerAuth: []
tags:
  - name: Projects
  - name: Orders
  - name: Loads
  - name: Jobs
  - name: JobAssignments
  - name: ApprovalAssignments
  - name: Equipment
  - name: FuelSurcharges
  - name: Materials
  - name: Accounts
  - name: Tickets
  - name: Users
  - name: Sites
  - name: Companies
  - name: Departments
  - name: Rates
  - name: Services
  - name: EquipmentType
  - name: FileAttachments
  - name: MaterialType
  - name: LineItemType
  - name: DriverStateEvent
  - name: Authentication
  - name: IamRoles
  - name: Typeaheads
  - name: Integrations
  - name: Reflection
  - name: LoadCycles
  - name: AddOns
  - name: ServiceClass
  - name: Invoices
  - name: JobSummaries
  - name: LoadSummaries
  - name: CompanyShares
  - name: UserDevicePermission
  - name: Drivers
  - name: Settlements
  - name: LocationHistories
  - name: Telematics
  - name: OmniReports
  - name: DriverDays
  - name: Agave
  - name: AddOnCharges
  - name: ResourceUsageLogs
  - name: ResourceScopes
  - name: TravelledDistances
  - name: MaterialRates
  - name: CompanyDayJobStats
  - name: KMLFiles
  - name: AutoAddOnAssignments
  - name: SiteRateSchedules
  - name: TwilioIntegrations
  - name: Foremen
  - name: AccountExternalTruckIdentifier
  - name: GeofenceTriggers
  - name: Labels
  - name: Compliance
  - name: ComplianceDocuments
paths:
  /v1/jobs/{job-id}/file_attachments:
    parameters:
      - schema:
          type: string
          format: uuid
        name: job-id
        in: path
        required: true
        description: 'The ID of the job you''re operating on '
      - $ref: '#/components/parameters/Accept-Language'
    post:
      tags:
        - FileAttachments
      summary: Create a FileAttachment on a Job
      description: >-
        Create a `FileAttachment` related to an `Job`. Requires permission to
        create attachment on `Job`—`create_job_attachments`.


        * If you're using a `DirectUpload` then you must use the
        `application/json` mime-type and `file` must be the `DirectUpload`'s
        `signed_id`

        * If you're using a file then you must use the `multipart/form-data`
        mime-type and `file` must be a file.
      operationId: post-v1-jobs-job_id-file_attachments
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/FileAttachment-Create'
          application/json:
            schema:
              $ref: '#/components/schemas/FileAttachment-Create'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/FileAttachment-Read'
        '401':
          $ref: '#/components/responses/UnauthenticatedError'
        '403':
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
        '406':
          $ref: '#/components/responses/Error'
        '415':
          $ref: '#/components/responses/Error'
        '422':
          $ref: '#/components/responses/ModelError'
components:
  parameters:
    Accept-Language:
      name: Accept-Language
      in: header
      schema:
        type: string
        default: en
        example: en
      description: >-
        The Accept-Language request HTTP header indicates the natural language
        and locale that the client prefers. 
  schemas:
    FileAttachment-Create:
      title: FileAttachment-Create
      x-stoplight:
        id: 6ov5mmeta4q9b
      type: object
      required:
        - file
      properties:
        file:
          x-stoplight:
            id: vhz4kd26m4atp
          anyOf:
            - x-stoplight:
                id: nax3vntqjrgyh
              format: binary
            - x-stoplight:
                id: zeyj90b4r3ds5
          type: string
        category:
          $ref: '#/components/schemas/FileAttachmentCategory'
        description:
          type: string
          x-stoplight:
            id: u5wjqpawbht5v
      additionalProperties: false
    FileAttachment-Read:
      title: FileAttachment-Read
      x-stoplight:
        id: 71buuls4yp0kr
      allOf:
        - type: object
          required:
            - category
            - description
            - file_attachable_id
            - file_attachable_type
            - file_url
            - mime_type
            - preview_url
            - preview_mime_type
            - uploaded_by
            - file_name
            - editable
            - deletable
          properties:
            category:
              $ref: '#/components/schemas/FileAttachmentCategory'
            description:
              type: string
              x-stoplight:
                id: tews9xplys3k7
              nullable: true
            file_attachable_id:
              type: string
              x-stoplight:
                id: f5skb1dhphjd2
              format: uuid
            file_attachable_type:
              $ref: '#/components/schemas/FileAttachableType'
            file_url:
              type: string
              x-stoplight:
                id: sx7sp0pkep7jl
              format: uri
            mime_type:
              type: string
              x-stoplight:
                id: vxj0ktghbiic6
            preview_url:
              type: string
              x-stoplight:
                id: aa7aa0pkep7jl
              format: uri
              description: >-
                URL of the preview image. Clients should fall back to file_url
                if this is null.
              nullable: true
            preview_mime_type:
              type: string
              x-stoplight:
                id: aaj0aaghbiic6
              description: >-
                mime-type of the preview. clients should fall back to mime_type
                if this is null.
              nullable: true
            uploaded_by:
              $ref: '#/components/schemas/Principal-Read-Nested'
            file_name:
              type: string
              x-stoplight:
                id: p56co3cqi23xo
            editable:
              type: boolean
              x-stoplight:
                id: sfbexk1hpc12a
            deletable:
              type: boolean
              x-stoplight:
                id: e3gtfckh2zwk3
        - $ref: '#/components/schemas/Identifier'
        - $ref: '#/components/schemas/Timestamps'
    FileAttachmentCategory:
      title: FileAttachmentCategory
      x-stoplight:
        id: baiohh0t8x4x2
      enum:
        - Inspection Report
        - Site Map
        - Scale Ticket (External)
        - Scale Ticket (Internal)
        - Timesheet
        - Other
      default: Other
    FileAttachableType:
      title: FileAttachableType
      x-stoplight:
        id: iabhoo1t2x4x8
      enum:
        - DriverDay
        - Job
        - Load
        - Order
        - Project
        - Settlement
        - Ticket
    Principal-Read-Nested:
      title: Principal-Read-Nested
      x-stoplight:
        id: oyruvwz2a9ddh
      allOf:
        - type: object
          required:
            - type
          properties:
            type:
              x-stoplight:
                id: up9qg59l8x5s0
              enum:
                - User
                - Company
                - M2MClient
                - Impersonation
        - x-stoplight:
            id: lz1m1s1btit0u
          anyOf:
            - $ref: '#/components/schemas/Company-Read-Nested'
            - $ref: '#/components/schemas/M2MClient-Read-Nested'
            - $ref: '#/components/schemas/User-Read-Minimal'
            - $ref: '#/components/schemas/Impersonation-Read-Minimal'
    Identifier:
      title: Identifier
      x-stoplight:
        id: gnd39lue5v7ol
      type: object
      required:
        - id
      properties:
        id:
          type: string
          x-stoplight:
            id: 2e38hjk4zd58m
          format: uuid
      additionalProperties: false
    Timestamps:
      title: Timestamps
      x-stoplight:
        id: t82ecgfu0oj00
      type: object
      required:
        - created_at
        - updated_at
      properties:
        created_at:
          type: string
          x-stoplight:
            id: gjj950jpq0ga9
          format: date-time
          description: ISO8601 timestamp with local timezone
        updated_at:
          type: string
          x-stoplight:
            id: bwcuyfwc7aj0e
          format: date-time
          description: ISO8601 timestamp with local timezone
      additionalProperties: false
    UnauthenticatedError-Response:
      title: UnauthenticatedError-Response
      x-stoplight:
        id: o477eph7ttbzt
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/UnauthenticatedError'
      additionalProperties: false
    Error-Response:
      title: Error-Response
      x-stoplight:
        id: 52cydhphee3qe
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/Error'
      additionalProperties: false
    ModelError-Response:
      title: ModelError-Response
      x-stoplight:
        id: payf9ndh3l6np
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ModelError'
      additionalProperties: false
    Company-Read-Nested:
      title: Company-Read-Nested
      x-stoplight:
        id: cb2kn77qmf1l7
      description: Compact Company model for nested reads.
      allOf:
        - $ref: '#/components/schemas/Identifier'
          x-stoplight:
            id: jwsufva4znm91
        - $ref: '#/components/schemas/TreadId'
        - type: object
          properties:
            legal_name:
              type: string
              x-stoplight:
                id: yc10t8hieecwk
              description: The Company's name. Must be globally unique.
            company_type:
              $ref: '#/components/schemas/CompanyType'
          required:
            - legal_name
            - company_type
    M2MClient-Read-Nested:
      title: M2MClient-Read-Nested
      x-stoplight:
        id: hf6su2qgixxmz
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          required:
            - company
          properties:
            company:
              $ref: '#/components/schemas/Company-Read-Nested'
    User-Read-Minimal:
      title: User-Read-Minimal
      x-stoplight:
        id: c25yzr29pbh5t
      allOf:
        - $ref: '#/components/schemas/User-Read-Typeahead'
        - $ref: '#/components/schemas/Discardable'
        - x-stoplight:
            id: qmk2e9npvoxcs
          type: object
          required:
            - company
          properties:
            company:
              $ref: '#/components/schemas/Company-Read-Nested'
    Impersonation-Read-Minimal:
      title: Impersonation-Read-Minimal
      x-stoplight:
        id: 1h5th7jnqtxix
      type: object
      required:
        - impersonator
        - impersonated
      properties:
        impersonator:
          $ref: '#/components/schemas/User-Read-Minimal'
        impersonated:
          $ref: '#/components/schemas/User-Read-Minimal'
    UnauthenticatedError:
      title: UnauthenticatedError
      x-stoplight:
        id: 202o69l0fs40h
      allOf:
        - $ref: '#/components/schemas/Error'
        - type: object
          x-stoplight:
            id: tg10dt7s0l6bw
          properties:
            error_type:
              type: string
              x-stoplight:
                id: wvq8c0qsym4hz
          required:
            - error_type
    Error:
      title: Error
      x-stoplight:
        id: 3g57kkik3l464
      type: object
      description: An Error.
      required:
        - code
      properties:
        code:
          type: string
          x-stoplight:
            id: 7o9x1t8v0bgfo
      additionalProperties: false
    ModelError:
      title: ModelError
      x-stoplight:
        id: nhp6714o4j1qt
      description: A Model-specific error
      allOf:
        - $ref: '#/components/schemas/Error'
        - type: object
          required:
            - errors
          properties:
            errors:
              type: array
              x-stoplight:
                id: m4ul9vcq2deh6
              items:
                $ref: '#/components/schemas/ModelError-Item'
    TreadId:
      title: TreadId
      x-stoplight:
        id: 43k4t5tl359m4
      type: object
      required:
        - tread_id
      properties:
        tread_id:
          type: string
          x-stoplight:
            id: zi3ld7djflw6f
          pattern: ^[0-9A-F]{6}$
          minLength: 6
          maxLength: 6
          example: ABC123
          description: Tread ID
      additionalProperties: false
    CompanyType:
      title: CompanyType
      x-stoplight:
        id: dkzo7gjbtb1b3
      enum:
        - broker
        - contractor
        - hauler
        - owner_operator
        - producer
        - super
      example: hauler
      description: Company Type
    User-Read-Typeahead:
      title: User-Read-Typeahead
      x-stoplight:
        id: ttbbss5b5k66f
      allOf:
        - $ref: '#/components/schemas/Identifier'
        - type: object
          required:
            - first_name
            - last_name
          properties:
            first_name:
              type: string
              description: First name
              x-stoplight:
                id: gwo999rcdahmg
            last_name:
              type: string
              description: Last name
              x-stoplight:
                id: l9omnnsq644bh
      description: ''
    Discardable:
      title: Discardable
      x-stoplight:
        id: 46axlb8u5wjay
      type: object
      required:
        - discarded_at
      properties:
        discarded_at:
          type: string
          x-stoplight:
            id: cy8t6fecoyxbo
          format: date-time
          nullable: true
      additionalProperties: false
    ModelError-Item:
      title: ModelError-Item
      x-stoplight:
        id: b93chwval2t8d
      type: object
      required:
        - model
        - field
        - message
      properties:
        model:
          type: string
          x-stoplight:
            id: 30myfyjkno8ao
          description: The Model associated with this Error
        field:
          type: string
          x-stoplight:
            id: 8gl4ed3uxhdws
          description: The field associated with this Error
        message:
          type: string
          x-stoplight:
            id: bmgbrtmw17qsj
          description: The Error message
      additionalProperties: false
  responses:
    UnauthenticatedError:
      description: Example response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UnauthenticatedError-Response'
            type: object
    Error:
      description: Error response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error-Response'
            type: object
    ModelError:
      description: ''
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ModelError-Response'
            type: object
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````