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

# Create a learning item with a file

> The two-step file path: the item is created and a pre-signed upload URL for `fileName` is returned. PUT the file's bytes to that URL; the item's `hasFile` becomes true once the upload completes.

**Requires scope:** `learning:write`.



## OpenAPI

````yaml /api-docs/openapi.v1.json post /api/v1/learning-items/with-file
openapi: 3.0.0
info:
  title: SkillsDB Public API
  description: >-
    The SkillsDB public REST API. Authenticate every request with an API key
    created in Settings → API Credentials, sent as `Authorization: Bearer
    sdb_live_…`. Errors follow RFC 9457 problem details; every `type` URI
    resolves under https://help.skillsdb.com/api-docs/errors/.
  version: '1'
  contact: {}
servers:
  - url: https://prod.skillsdbnext.com
    description: Production
  - url: https://staging.skillsdbnext.com
    description: Staging
security: []
tags: []
paths:
  /api/v1/learning-items/with-file:
    post:
      tags:
        - Learning Item
      summary: Create a learning item with a file
      description: >-
        The two-step file path: the item is created and a pre-signed upload URL
        for `fileName` is returned. PUT the file's bytes to that URL; the item's
        `hasFile` becomes true once the upload completes.


        **Requires scope:** `learning:write`.
      operationId: createLearningItemWithFile
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          description: >-
            Any unique string (at most 200 characters). Retrying with the same
            key and identical content replays the stored response for 24h
            instead of executing twice.
          schema:
            type: string
            maxLength: 200
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateLearningItemWithFileDto'
      responses:
        '201':
          description: The created resource, enveloped.
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/LearningItemWithUploadDto'
          headers:
            X-Request-Id:
              description: Unique id for this request — quote it when contacting support.
              schema:
                type: string
            RateLimit-Limit:
              description: The bucket's hourly allowance.
              schema:
                type: integer
            RateLimit-Remaining:
              description: Requests left in the current window.
              schema:
                type: integer
            RateLimit-Reset:
              description: Seconds until the window resets.
              schema:
                type: integer
            Idempotency-Replayed:
              description: >-
                `true` when this response was replayed from a previous execution
                under the same Idempotency-Key.
              schema:
                type: string
        '400':
          description: >-
            Validation failed
            (`https://help.skillsdb.com/api-docs/errors/validation-error`)
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetailsDto'
          headers:
            X-Request-Id:
              description: Unique id for this request — quote it when contacting support.
              schema:
                type: string
            RateLimit-Limit:
              description: The bucket's hourly allowance.
              schema:
                type: integer
            RateLimit-Remaining:
              description: Requests left in the current window.
              schema:
                type: integer
            RateLimit-Reset:
              description: Seconds until the window resets.
              schema:
                type: integer
        '401':
          description: >-
            Invalid credential
            (`https://help.skillsdb.com/api-docs/errors/invalid-credential`)
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetailsDto'
          headers:
            X-Request-Id:
              description: Unique id for this request — quote it when contacting support.
              schema:
                type: string
            RateLimit-Limit:
              description: The bucket's hourly allowance.
              schema:
                type: integer
            RateLimit-Remaining:
              description: Requests left in the current window.
              schema:
                type: integer
            RateLimit-Reset:
              description: Seconds until the window resets.
              schema:
                type: integer
        '403':
          description: >-
            Insufficient scope
            (`https://help.skillsdb.com/api-docs/errors/insufficient-scope`) ·
            Insufficient permissions
            (`https://help.skillsdb.com/api-docs/errors/insufficient-permissions`)
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetailsDto'
          headers:
            X-Request-Id:
              description: Unique id for this request — quote it when contacting support.
              schema:
                type: string
            RateLimit-Limit:
              description: The bucket's hourly allowance.
              schema:
                type: integer
            RateLimit-Remaining:
              description: Requests left in the current window.
              schema:
                type: integer
            RateLimit-Reset:
              description: Seconds until the window resets.
              schema:
                type: integer
        '404':
          description: Not found (`https://help.skillsdb.com/api-docs/errors/not-found`)
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetailsDto'
          headers:
            X-Request-Id:
              description: Unique id for this request — quote it when contacting support.
              schema:
                type: string
            RateLimit-Limit:
              description: The bucket's hourly allowance.
              schema:
                type: integer
            RateLimit-Remaining:
              description: Requests left in the current window.
              schema:
                type: integer
            RateLimit-Reset:
              description: Seconds until the window resets.
              schema:
                type: integer
        '409':
          description: >-
            Idempotency key reused with different content
            (`https://help.skillsdb.com/api-docs/errors/idempotency-key-reused`)
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetailsDto'
          headers:
            X-Request-Id:
              description: Unique id for this request — quote it when contacting support.
              schema:
                type: string
            RateLimit-Limit:
              description: The bucket's hourly allowance.
              schema:
                type: integer
            RateLimit-Remaining:
              description: Requests left in the current window.
              schema:
                type: integer
            RateLimit-Reset:
              description: Seconds until the window resets.
              schema:
                type: integer
        '429':
          description: >-
            Rate limit exceeded
            (`https://help.skillsdb.com/api-docs/errors/rate-limit-exceeded`)
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetailsDto'
          headers:
            X-Request-Id:
              description: Unique id for this request — quote it when contacting support.
              schema:
                type: string
            RateLimit-Limit:
              description: The bucket's hourly allowance.
              schema:
                type: integer
            RateLimit-Remaining:
              description: Requests left in the current window.
              schema:
                type: integer
            RateLimit-Reset:
              description: Seconds until the window resets.
              schema:
                type: integer
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
        '500':
          description: >-
            Internal error
            (`https://help.skillsdb.com/api-docs/errors/internal-error`)
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetailsDto'
          headers:
            X-Request-Id:
              description: Unique id for this request — quote it when contacting support.
              schema:
                type: string
            RateLimit-Limit:
              description: The bucket's hourly allowance.
              schema:
                type: integer
            RateLimit-Remaining:
              description: Requests left in the current window.
              schema:
                type: integer
            RateLimit-Reset:
              description: Seconds until the window resets.
              schema:
                type: integer
      security:
        - apiKey:
            - learning:write
components:
  schemas:
    CreateLearningItemWithFileDto:
      type: object
      properties:
        description:
          type: string
          example: Annual refresher for licensed operators.
          maxLength: 4000
          nullable: true
        url:
          type: string
          example: https://learn.example.com/forklift
          maxLength: 500
          nullable: true
        durationHours:
          type: number
          example: 2.5
          nullable: true
        cost:
          type: number
          example: 120
          nullable: true
        costDescription:
          type: string
          example: Per seat
          maxLength: 500
          nullable: true
        providerId:
          type: string
          example: '3'
          nullable: true
          description: Training provider id (reference list).
        formatId:
          type: string
          example: '2'
          nullable: true
          description: Training format id (reference list).
        audienceId:
          type: string
          example: '1'
          nullable: true
          description: Training audience id (reference list).
        courseLevelId:
          type: string
          example: '4'
          nullable: true
          description: Training course level id (reference list).
        referenceId:
          type: string
          example: LMS-4471
          maxLength: 100
          nullable: true
        title:
          type: string
          example: Forklift Safety Refresher
          maxLength: 500
        typeId:
          type: string
          example: '1'
          description: Learning type id (reference list). Required.
        labelIds:
          description: Label ids to attach.
          type: array
          items:
            type: string
        skillIds:
          description: Skill ids to attach the item to.
          type: array
          items:
            type: string
        fileName:
          type: string
          example: forklift-refresher.pdf
          maxLength: 255
          description: The file to upload after the call.
      required:
        - title
        - typeId
        - fileName
    LearningItemWithUploadDto:
      type: object
      properties:
        item:
          $ref: '#/components/schemas/LearningItemDto'
        uploadUrl:
          type: string
          description: Pre-signed PUT URL for the item's file, valid for a short time.
      required:
        - item
        - uploadUrl
    ProblemDetailsDto:
      type: object
      properties:
        type:
          type: string
          example: https://help.skillsdb.com/api-docs/errors/validation-error
          description: >-
            A URI identifying the problem type — always resolves to a
            documentation page.
        title:
          type: string
          example: Validation failed
        status:
          type: number
          example: 400
        detail:
          type: string
          example: limit must be between 1 and 200
          description: Human-readable explanation specific to this occurrence.
        instance:
          type: string
          example: /api/v1/people
        requestId:
          type: string
          example: 0192c2f1-6f4e-7ab3-b1c4-5f6a7b8c9d0e
          description: >-
            Matches the X-Request-Id response header — quote it when contacting
            support.
        errors:
          description: Field-level failures, present on validation-error problems.
          type: array
          items:
            $ref: '#/components/schemas/ProblemFieldErrorDto'
        error:
          type: string
          example: trial_expired
          enum:
            - trial_expired
          description: >-
            Present only on a 403 when the workspace's trial has expired, so API
            access is suspended.
        upgrade_url:
          type: string
          example: https://app.skillsdb.com/settings/billing
          description: >-
            Present only alongside `error: trial_expired`: where a workspace
            admin upgrades to restore API access.
      required:
        - type
        - title
        - status
        - detail
        - instance
        - requestId
    LearningItemDto:
      type: object
      properties:
        id:
          type: string
          example: '512'
          description: Opaque learning item id.
        title:
          type: string
          example: Forklift Safety Refresher
        description:
          type: string
          example: Annual refresher for licensed operators.
          nullable: true
        url:
          type: string
          example: https://learn.example.com/forklift
          nullable: true
        durationHours:
          type: number
          example: 2.5
          nullable: true
        cost:
          type: number
          example: 120
          nullable: true
        costDescription:
          type: string
          example: Per seat, invoiced quarterly
          nullable: true
        type:
          nullable: true
          description: Learning type.
          allOf:
            - $ref: '#/components/schemas/ReferenceEntryRefDto'
        provider:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/ReferenceEntryRefDto'
        format:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/ReferenceEntryRefDto'
        audience:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/ReferenceEntryRefDto'
        courseLevel:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/ReferenceEntryRefDto'
        imageUrl:
          type: string
          example: https://cdn.example.com/forklift.png
          nullable: true
          description: Display image.
        hasFile:
          type: boolean
          example: true
          description: >-
            An attached file exists — use the download-url operation to fetch
            it.
        referenceId:
          type: string
          example: LMS-4471
          nullable: true
          description: >-
            Caller-supplied external identifier — the closest thing to an
            idempotency key for items.
        labels:
          description: Labels attached to the item.
          type: array
          items:
            $ref: '#/components/schemas/NamedRefDto'
        skillNames:
          example:
            - Forklift Operation
          description: Names of the skills the item is attached to.
          type: array
          items:
            type: string
        careerNames:
          example:
            - Warehouse Operator
          description: Names of the careers the item appears on.
          type: array
          items:
            type: string
        assignedCount:
          type: number
          example: 40
          description: People assigned the item (active people only).
        inProgressCount:
          type: number
          example: 12
        completedCount:
          type: number
          example: 25
        averageRating:
          type: number
          example: 1.6
          nullable: true
          description: >-
            Average rating across rated plans (0 = thumbs down, 1 = thumbs up, 2
            = double thumbs up).
        createdAt:
          type: string
          example: '2026-01-12T08:30:00.000Z'
          nullable: true
        updatedAt:
          type: string
          example: null
          nullable: true
      required:
        - id
        - title
        - description
        - url
        - durationHours
        - cost
        - costDescription
        - type
        - provider
        - format
        - audience
        - courseLevel
        - imageUrl
        - hasFile
        - referenceId
        - labels
        - skillNames
        - careerNames
        - assignedCount
        - inProgressCount
        - completedCount
        - averageRating
        - createdAt
        - updatedAt
    ProblemFieldErrorDto:
      type: object
      properties:
        field:
          type: string
          example: email
        code:
          type: string
          example: max_length
        message:
          type: string
          example: email must be shorter than or equal to 75 characters
      required:
        - field
        - code
        - message
    ReferenceEntryRefDto:
      type: object
      properties:
        id:
          type: string
          example: '3'
          description: Opaque reference entry id.
        name:
          type: string
          example: Online course
      required:
        - id
        - name
    NamedRefDto:
      type: object
      properties:
        id:
          type: string
          example: '77'
        name:
          type: string
          example: Forklift Operation
      required:
        - id
        - name
  securitySchemes:
    apiKey:
      scheme: bearer
      type: http
      description: >-
        An API key issued by a company administrator — an environment prefix
        (production: `sdb_live_`) followed by 32 characters. The prefix
        identifies the environment and MUST NOT be hard-coded or validated by
        clients; treat the whole key as opaque. Shown exactly once at creation;
        only a one-way hash is stored.


        **Scopes** (granted per key on the create screen; `:write` never implies
        `:read`):


        - `skills:read`

        - `skills:write`

        - `people:read`

        - `people:write`

        - `careers:read`

        - `careers:write`

        - `training:read`

        - `training:write`

        - `flags:read`

        - `flags:write`

        - `org:read`

        - `org:write`

        - `assessments:read`

        - `learning:read`

        - `learning:write`

        - `certifications:read`

        - `certifications:write`

        - `assessments:write`

        - `proficiency:read`

        - `proficiency:write`

        - `surveys:read`

        - `surveys:write`

        - `labels:read`

        - `labels:write`

````