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

# Create Resource

> Attach a file, external link, or external video to an item. For `file` resources, the response includes an `uploadUrl` — a presigned S3 URL that you must PUT the file to (with the same `Content-Type` as `fileMimeType`) to complete the upload. `link` and `video` resources have no upload step and return `uploadUrl: null`.



## OpenAPI

````yaml POST /items/{itemId}/resources/create
openapi: 3.1.0
info:
  title: Haystack API
  description: Content management and semantic search API for Haystack
  version: 2.0.0
  contact:
    name: Haystack Support
    email: support@thehaystack.ai
    url: https://thehaystack.ai
servers:
  - url: https://api.thehaystack.ai/v2/haystack
    description: Production server
security:
  - bearerAuth: []
tags:
  - name: Items
    description: Content item management
  - name: Collections
    description: Top-level content organization
  - name: Series
    description: Multi-part content grouping
  - name: Speakers
    description: Content presenter management
  - name: Media
    description: Video and audio asset management
  - name: Search
    description: Semantic content search
  - name: Analytics
    description: Usage statistics and metrics
  - name: Resources
    description: Attach supplementary files, links, and videos to items
  - name: Scriptures
    description: Attach Bible references to items
  - name: Chapters
    description: Time-based chapter markers on media assets
  - name: Stats
    description: Analytics and reporting
  - name: Frontend
    description: Public frontend configuration
paths:
  /items/{itemId}/resources/create:
    post:
      tags:
        - Resources
      summary: Create resource
      description: >-
        Attach a file, external link, or external video to an item. For `file`
        resources, the response includes an `uploadUrl` — a presigned S3 URL
        that you must PUT the file to (with the same `Content-Type` as
        `fileMimeType`) to complete the upload. `link` and `video` resources
        have no upload step and return `uploadUrl: null`.
      parameters:
        - name: itemId
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - title
                - contentType
              properties:
                title:
                  type: string
                  description: Display title for the resource
                subTitle:
                  type: string
                  nullable: true
                description:
                  type: string
                  nullable: true
                resourceTypeId:
                  type: integer
                  nullable: true
                  description: Category for grouping (see /resource-types)
                contentType:
                  type: string
                  enum:
                    - file
                    - link
                    - video
                fileMimeType:
                  type: string
                  description: Required when contentType is `file`
                  example: application/pdf
                fileSizeBytes:
                  type: integer
                  description: Required when contentType is `file`
                  example: 1048576
                originalFilename:
                  type: string
                  description: Original filename, used to choose an extension
                linkTarget:
                  type: string
                  format: uri
                  description: Required when contentType is `link`
                externalPlatform:
                  type: string
                  enum:
                    - youtube
                    - vimeo
                  description: Required when contentType is `video`
                externalPlatformId:
                  type: string
                  description: Required when contentType is `video`
                  example: dQw4w9WgXcQ
      responses:
        '200':
          description: >-
            Resource created. For `file` content type, upload the file to
            `uploadUrl` via PUT to complete.
          content:
            application/json:
              schema:
                type: object
                properties:
                  resource:
                    $ref: '#/components/schemas/ItemResource'
                  uploadUrl:
                    type: string
                    nullable: true
                    description: >-
                      Presigned S3 URL for file uploads (PUT). Null for link and
                      video resources.
                    example: https://s3.amazonaws.com/bucket/key?signature=...
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Item not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    ItemResource:
      type: object
      properties:
        id:
          type: integer
        itemId:
          type: integer
        title:
          type: string
        subTitle:
          type: string
          nullable: true
        description:
          type: string
          nullable: true
        resourceTypeId:
          type: integer
          nullable: true
        displayOrder:
          type: integer
          nullable: true
        contentType:
          type: string
          enum:
            - file
            - link
            - video
        fileMimeType:
          type: string
          nullable: true
        fileSizeBytes:
          type: integer
          nullable: true
        externalPlatform:
          type: string
          enum:
            - youtube
            - vimeo
          nullable: true
        externalPlatformId:
          type: string
          nullable: true
        thumbnailImgUrl:
          type: string
          nullable: true
          description: URL to the resource thumbnail image
        url:
          type: string
          nullable: true
          description: URL to access the resource (file URL or external link)
        resourceType:
          allOf:
            - $ref: '#/components/schemas/ResourceType'
          nullable: true
          description: Included when _expand contains 'resourceType'
        linkTarget:
          type: string
          nullable: true
          description: Target URL for link-type resources
    Error:
      type: object
      properties:
        result:
          type: string
          enum:
            - error
        error:
          type: object
          properties:
            type:
              type: string
            message:
              type: string
    ResourceType:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
          description: Display name for the resource category
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Enter your API token from the Haystack dashboard

````