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

# Create a transcription (Source) from text or upload

> Two body shapes:

* `type: "text"` — caller supplies already-transcribed text;
  the row is stored with `status: Success` immediately and
  the response is a `SourceSingle`.
* `type: "file"` — caller passes a prior `uploadId` returned
  by `POST /v1/uploads`; the worker pulls bytes from S3,
  transcribes, and indexes. The response is a `JobSingle`
  with `type: SOURCE_INGEST_FILE`. Poll `GET /v1/jobs/{id}`
  for completion; `result.sourceId` lands on `DONE`.

Required scope: `sources:write`.




## OpenAPI

````yaml /openapi/v1.yaml post /sources
openapi: 3.1.0
info:
  title: Scripe Public API
  version: '2026-08-01'
  summary: Read-only access to Scripe workspaces, projects, notes, posts, and sources.
  description: |
    The Scripe public API gives integrators stable, versioned read access
    to a workspace's content surface. Phase 2 ships read endpoints only;
    write endpoints land in Phase 3.

    All endpoints (except `/v1/health`) require a Bearer API key. Pin the
    API version with the `Scripe-Api-Version` request header to opt out
    of breaking changes.
  contact:
    name: Scripe Support
    url: https://scripe.io/support
    email: support@scripe.io
  license:
    name: Proprietary
servers:
  - url: https://api.scripe.io/v1
    description: Production
security:
  - BearerApiKey: []
tags:
  - name: Health
    description: Liveness and authenticated key smoke tests.
  - name: Workspace
    description: The workspace + principal resolved from your API key.
  - name: Projects
    description: Personal-brand, company-page, and amplifier projects.
  - name: Notes
    description: Project notes with paired calendar slot.
  - name: Posts
    description: Drafts, scheduled, and published LinkedIn posts.
  - name: Analytics
    description: Your own LinkedIn analytics and viral-post inspiration search.
  - name: Sources
    description: Transcriptions (audio/video sources) with truncated body.
  - name: Uploads
    description: >-
      Pre-signed S3 PUT URLs the customer uploads bytes to before referencing
      via Sources or Knowledge.
  - name: Knowledge
    description: >-
      Knowledge-base documents indexed for RAG. Async ingest via text, file,
      URL, or YouTube.
  - name: Jobs
    description: >-
      Async-job lifecycle — submitted via post-generation, knowledge ingest,
      file source.
  - name: Webhooks
    description: |
      Outbound HTTP callbacks. Subscribe an endpoint to one or more
      event names; we POST a signed JSON payload every time a matching
      event fires in the workspace. The signing secret is shown once
      on create and once on rotate — verify the
      `Webhook-Signature: t=<ts>,v1=<hmac>` header on every delivery.
paths:
  /sources:
    post:
      tags:
        - Sources
      summary: Create a transcription (Source) from text or upload
      description: |
        Two body shapes:

        * `type: "text"` — caller supplies already-transcribed text;
          the row is stored with `status: Success` immediately and
          the response is a `SourceSingle`.
        * `type: "file"` — caller passes a prior `uploadId` returned
          by `POST /v1/uploads`; the worker pulls bytes from S3,
          transcribes, and indexes. The response is a `JobSingle`
          with `type: SOURCE_INGEST_FILE`. Poll `GET /v1/jobs/{id}`
          for completion; `result.sourceId` lands on `DONE`.

        Required scope: `sources:write`.
      operationId: createSource
      parameters:
        - $ref: '#/components/parameters/ScripeApiVersion'
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SourceCreate'
      responses:
        '200':
          description: |
            Source created synchronously (`type: "text"`) or job
            enqueued (`type: "file"`). The response shape depends on
            which body was supplied — replayed via Idempotency-Key
            preserves the original shape.
          headers:
            Idempotent-Replayed:
              schema:
                type: string
                enum:
                  - 'true'
                  - 'false'
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/SourceSingle'
                  - $ref: '#/components/schemas/JobSingle'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/SpendCapExceeded'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/IdempotencyConflict'
        '413':
          $ref: '#/components/responses/PayloadTooLarge'
        '422':
          $ref: '#/components/responses/Unprocessable'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  parameters:
    ScripeApiVersion:
      name: Scripe-Api-Version
      in: header
      required: false
      description: |
        Pin the API version. Format `YYYY-MM-DD`. Omit to receive the
        currently rolling default. Unknown versions return `400
        version_unsupported`.
      schema:
        type: string
        example: '2026-08-01'
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      description: |
        Opaque string (1–64 chars, `[A-Za-z0-9_-]`) used to dedup
        retried writes. Within 24h of the first request, the same key
        + same body returns the original response (`Idempotent-Replayed:
        true`). Same key + different body returns `409
        idempotency_key_conflict`.

        Strongly recommended for every write — see
        `/docs/api/v1/idempotency`.
      schema:
        type: string
        pattern: ^[A-Za-z0-9_-]{1,64}$
  schemas:
    SourceCreate:
      oneOf:
        - $ref: '#/components/schemas/SourceCreateText'
        - $ref: '#/components/schemas/SourceCreateFile'
      discriminator:
        propertyName: type
        mapping:
          text:
            $ref: '#/components/schemas/SourceCreateText'
          file:
            $ref: '#/components/schemas/SourceCreateFile'
    SourceSingle:
      type: object
      required:
        - data
      properties:
        data:
          $ref: '#/components/schemas/Source'
    JobSingle:
      type: object
      required:
        - data
      properties:
        data:
          $ref: '#/components/schemas/Job'
    SourceCreateText:
      type: object
      required:
        - type
        - projectId
        - text
      properties:
        type:
          type: string
          enum:
            - text
        projectId:
          type: string
          example: proj_a1b2c3d4e5f6g7h8
        text:
          type: string
          maxLength: 1000000
          description: Already-transcribed body text.
        name:
          type: string
          nullable: true
          description: Optional human-friendly label.
    SourceCreateFile:
      type: object
      required:
        - type
        - projectId
        - uploadId
      properties:
        type:
          type: string
          enum:
            - file
        projectId:
          type: string
          example: proj_a1b2c3d4e5f6g7h8
        uploadId:
          type: string
          example: upl_acme_workspace_random_id_xxx
          description: |
            Opaque handle returned by `POST /v1/uploads`. The bytes
            must already be uploaded to S3 before calling this
            endpoint.
        name:
          type: string
          nullable: true
          description: Optional human-friendly label.
    Source:
      type: object
      required:
        - id
        - projectId
        - status
        - durationSeconds
        - createdAt
        - textPreview
        - textPreviewTruncated
        - hasFullText
      properties:
        id:
          type: string
          example: src_a1b2c3d4e5f6g7h8
        projectId:
          type: string
        status:
          type: string
          example: Done
        name:
          type: string
          nullable: true
        fileType:
          type: string
          nullable: true
        durationSeconds:
          type: number
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
          nullable: true
        textPreview:
          type: string
          maxLength: 2000
        textPreviewTruncated:
          type: boolean
        hasFullText:
          type: boolean
        topics:
          type: array
          description: |-
            Topics detected on the source after ingest, best-ranked first.
            Each topic carries the hooks generated for it (a separate
            async pass; the array is empty until the hook-generator
            runs). Omitted while the source is still processing.
          items:
            $ref: '#/components/schemas/SourceTopic'
    Job:
      type: object
      required:
        - id
        - type
        - status
        - projectId
        - startedAt
        - completedAt
        - progress
        - result
        - errorCode
        - errorMessage
        - attemptCount
        - estimatedCompletionMs
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
          example: job_a1b2c3d4e5f6g7h8
        type:
          type: string
          example: POST_GENERATION
          description: |
            One of `POST_GENERATION`, `KB_INGEST_TEXT`, `KB_INGEST_FILE`,
            `KB_INGEST_URL`, `KB_INGEST_YOUTUBE`, `SOURCE_INGEST_FILE`.
        status:
          type: string
          example: QUEUED
          description: One of `QUEUED`, `RUNNING`, `DONE`, `FAILED`, `CANCELLED`.
        projectId:
          type: string
          nullable: true
        startedAt:
          type: string
          format: date-time
          nullable: true
        completedAt:
          type: string
          format: date-time
          nullable: true
        progress:
          type: object
          nullable: true
          required:
            - progress
            - updatedAt
          properties:
            progress:
              type: number
              minimum: 0
              maximum: 1
            message:
              type: string
            updatedAt:
              type: string
              format: date-time
        result:
          type: object
          nullable: true
          additionalProperties: true
          description: |
            Worker-populated only when status is `DONE`. Shape varies
            per `type`. Post generation populates `{ "post": { "id":
            "post_..." } }`; knowledge ingest populates `{ "documentId":
            "doc_..." }`; etc.
        errorCode:
          type: string
          nullable: true
        errorMessage:
          type: string
          nullable: true
        attemptCount:
          type: integer
          minimum: 0
        estimatedCompletionMs:
          type: integer
          nullable: true
          description: Rolling p50 hint for clients deciding whether to wait.
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
          nullable: true
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
            - request_id
            - docs_url
          properties:
            code:
              type: string
              description: Stable, machine-readable error identifier.
              example: not_found
            message:
              type: string
            request_id:
              type: string
              example: req_a1b2c3d4e5f6
            docs_url:
              type: string
              format: uri
            details:
              description: Optional structured payload — shape varies per code.
    SourceTopic:
      type: object
      required:
        - id
        - title
        - summary
        - keyTakeaways
        - ranking
        - score
        - fromSeconds
        - toSeconds
        - hooks
      properties:
        id:
          type: string
          example: tpc_a1b2c3d4e5f6g7h8
        title:
          type: string
        summary:
          type: string
        keyTakeaways:
          type: array
          items:
            type: string
        ranking:
          type: integer
          nullable: true
          description: 1-based ranking across the source's topics. `null` until rated.
        score:
          type: integer
          nullable: true
          description: Quality score 0–100. `null` until rated.
        fromSeconds:
          type: number
          description: Approximate start position in the source. 0 for text-only sources.
        toSeconds:
          type: number
          description: Approximate end position in the source. 0 for text-only sources.
        hooks:
          type: array
          items:
            $ref: '#/components/schemas/SourceHook'
    SourceHook:
      type: object
      required:
        - id
        - content
        - postType
        - contentType
      properties:
        id:
          type: string
          example: hk_a1b2c3d4e5f6g7h8
        content:
          type: string
        postType:
          type: string
          nullable: true
        contentType:
          type: string
          nullable: true
  responses:
    BadRequest:
      description: Malformed request (bad cursor, bad limit, etc.).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing, malformed, expired, or revoked API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    SpendCapExceeded:
      description: |
        Daily AI-spend cap reached for this workspace. Resets at
        00:00 UTC.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: Plan not eligible, scope missing, or workspace mismatch.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Resource not found in this workspace.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    IdempotencyConflict:
      description: |
        `Idempotency-Key` reused with a different body within the
        24h dedup window. Pick a fresh key or replay the original
        body verbatim.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    PayloadTooLarge:
      description: Request body exceeds the size cap.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unprocessable:
      description: Body shape was JSON but failed validation (`unprocessable`).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: Sliding-window rate limit exceeded.
      headers:
        Retry-After:
          schema:
            type: integer
        X-RateLimit-Limit:
          schema:
            type: integer
        X-RateLimit-Remaining:
          schema:
            type: integer
        X-RateLimit-Reset:
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    BearerApiKey:
      type: http
      scheme: bearer
      bearerFormat: scripe_sk_live_*
      description: |
        Pass `Authorization: Bearer scripe_sk_live_<...>` (or
        `scripe_sk_test_<...>` for test keys) on every request. Keys
        are scoped to a single workspace and can be revoked from the
        Scripe dashboard.

````