> ## 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.

# Batch grant access (multiple apps x multiple users)

> Open multiple apps you own to multiple users at once (matrix
semantics, idempotent).

Same storage and effect rules as the single-user PUT: the user id is
stored, the list is stored orthogonally to scope, and grants take
effect when scope=shared. Each username is resolved once. `granted`
counts **newly added** pairs — pairs already on the list are skipped
idempotently, letting the caller distinguish "3 added, 2 already
granted".



## OpenAPI

````yaml /jp/datahub/api/openapi.json post /v1/data-apps/batch/grants
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/batch/grants:
    post:
      tags:
        - Publishing
      summary: Batch grant access (multiple apps x multiple users)
      description: |-
        Open multiple apps you own to multiple users at once (matrix
        semantics, idempotent).

        Same storage and effect rules as the single-user PUT: the user id is
        stored, the list is stored orthogonally to scope, and grants take
        effect when scope=shared. Each username is resolved once. `granted`
        counts **newly added** pairs — pairs already on the list are skipped
        idempotently, letting the caller distinguish "3 added, 2 already
        granted".
      operationId: batch_grant_access_v1_data_apps_batch_grants_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchGrantsRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataEnvelope_BatchGrantsResult_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    BatchGrantsRequest:
      properties:
        app_names:
          items:
            type: string
          type: array
          title: App Names
        usernames:
          items:
            type: string
          type: array
          title: Usernames
      type: object
      required:
        - app_names
        - usernames
      title: BatchGrantsRequest
      description: |-
        Batch grants (app x user matrix): open several of the caller's apps to
        several users at once.
    DataEnvelope_BatchGrantsResult_:
      properties:
        data:
          $ref: '#/components/schemas/BatchGrantsResult'
      type: object
      required:
        - data
      title: DataEnvelope[BatchGrantsResult]
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    BatchGrantsResult:
      properties:
        granted:
          type: integer
          title: Granted
        requested:
          type: integer
          title: Requested
        apps:
          items:
            $ref: '#/components/schemas/BatchAppResult'
          type: array
          title: Apps
        users:
          items:
            $ref: '#/components/schemas/BatchUserResult'
          type: array
          title: Users
      type: object
      required:
        - granted
        - requested
        - apps
        - users
      title: BatchGrantsResult
    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
    BatchAppResult:
      properties:
        app_name:
          type: string
          title: App Name
        ok:
          type: boolean
          title: Ok
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
      type: object
      required:
        - app_name
        - ok
      title: BatchAppResult
    BatchUserResult:
      properties:
        username:
          type: string
          title: Username
        ok:
          type: boolean
          title: Ok
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
      type: object
      required:
        - username
        - ok
      title: BatchUserResult
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: DataHub API Key

````