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

# Save the draft (Workspace, owner only)

> Save the app's mutable draft: **a save is never rejected for
validation failures** — full validation still runs and the result
(valid/issues) comes back alongside; "save half now, keep editing
later" is a model promise.

The app identity is created implicitly on the first save (there is no
separate "create app" endpoint). Only three minimal hard checks
(400): the account has a username, the content is within the size
limit, and attached file names are legal (identity.app_name in the
manifest is no longer compared to the path — the routing name follows
the ref; the declared name in the file is consumed only at creation).
Optimistic concurrency via expected_revision (409 revision-conflict;
multiple tabs never overwrite silently). Bundled secrets are stored
only when this save is valid (no credentials scattered from
half-finished drafts); names not stored are reported via
secrets_deferred. Editing stays allowed while deprecated
(self-testing is harmless; what is rejected is a new Release).



## OpenAPI

````yaml /jp/datahub/api/openapi.json put /v1/data-apps/{app_id}/workspace
openapi: 3.1.0
info:
  title: DataHub API
  version: 0.2.0
  description: Public /v1 contract of Octoparse DataHub. Internal channels are excluded.
servers:
  - url: https://api-datahub.octoparse.com
security:
  - bearerAuth: []
tags:
  - name: Discovery
    description: >-
      Anonymous access: platform metadata (currency), data app search, detail
      and input contract, machine-readable manifest spec.
  - name: Publishing
    description: >-
      Self-service publishing channel (API Key auth), two-phase: validate first
      (validate / package, nothing persisted), then publish (POST /data-apps,
      the submission goes live as a new Release). api kind (declarative
      integration) becomes visible on publish; code kind (code package) returns
      202 and enters an async image build; once ready it is promoted to a
      Release, visible and runnable. Poll progress via GET
      /data-apps/{ref}/builds.
  - name: Runs & Results
    description: >-
      Start / query / cancel runs and read result records with pagination.
      Business inputs go in the request body; platform run options (wait,
      max_records) go in query parameters.
  - name: Datasets
    description: >-
      Metadata and record access for platform datasets (including seeded stock
      data).
  - name: Account
    description: Account info and cumulative usage for the current API Key.
  - name: Secrets
    description: >-
      CRUD for upstream credentials (environment entries referenced by manifest
      `runtime.env`). Plaintext is write-only: every read returns a mask.
paths:
  /v1/data-apps/{app_id}/workspace:
    put:
      tags:
        - Publishing
      summary: Save the draft (Workspace, owner only)
      description: |-
        Save the app's mutable draft: **a save is never rejected for
        validation failures** — full validation still runs and the result
        (valid/issues) comes back alongside; "save half now, keep editing
        later" is a model promise.

        The app identity is created implicitly on the first save (there is no
        separate "create app" endpoint). Only three minimal hard checks
        (400): the account has a username, the content is within the size
        limit, and attached file names are legal (identity.app_name in the
        manifest is no longer compared to the path — the routing name follows
        the ref; the declared name in the file is consumed only at creation).
        Optimistic concurrency via expected_revision (409 revision-conflict;
        multiple tabs never overwrite silently). Bundled secrets are stored
        only when this save is valid (no credentials scattered from
        half-finished drafts); names not stored are reported via
        secrets_deferred. Editing stays allowed while deprecated
        (self-testing is harmless; what is rejected is a new Release).
      operationId: put_app_workspace_v1_data_apps__app_id__workspace_put
      parameters:
        - name: app_id
          in: path
          required: true
          schema:
            type: string
            title: App Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkspaceSubmission'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataEnvelope_WorkspaceSaveResult_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    WorkspaceSubmission:
      properties:
        manifest:
          type: string
          title: Manifest
        files:
          additionalProperties:
            type: string
          type: object
          title: Files
        secrets:
          additionalProperties:
            type: string
          type: object
          title: Secrets
        expected_revision:
          anyOf:
            - type: integer
            - type: 'null'
          title: Expected Revision
      type: object
      required:
        - manifest
      title: WorkspaceSubmission
      description: |-
        PUT workspace request body: may be incomplete (validation issues are
        returned alongside the save; the write is not rejected).
    DataEnvelope_WorkspaceSaveResult_:
      properties:
        data:
          $ref: '#/components/schemas/WorkspaceSaveResult'
      type: object
      required:
        - data
      title: DataEnvelope[WorkspaceSaveResult]
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    WorkspaceSaveResult:
      properties:
        app_name:
          type: string
          title: App Name
        app_id:
          type: string
          title: App Id
        namespace:
          anyOf:
            - type: string
            - type: 'null'
          title: Namespace
        revision:
          type: integer
          title: Revision
        valid:
          type: boolean
          title: Valid
        issues:
          items:
            $ref: '#/components/schemas/ManifestIssue'
          type: array
          title: Issues
        missing_secrets:
          items:
            type: string
          type: array
          title: Missing Secrets
        secrets_deferred:
          items:
            type: string
          type: array
          title: Secrets Deferred
        name_reused_from:
          anyOf:
            - type: string
            - type: 'null'
          title: Name Reused From
      type: object
      required:
        - app_name
        - app_id
        - revision
        - valid
      title: WorkspaceSaveResult
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ManifestIssue:
      properties:
        path:
          type: string
          title: Path
        message:
          type: string
          title: Message
      type: object
      required:
        - path
        - message
      title: ManifestIssue
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: DataHub API Key

````