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

# grant 일괄

> 여러 App을 여러 사용자에게 한 호출로 공유. 행렬 의미, 멱등.

**`POST`** `https://api-datahub.octoparse.com/v1/data-apps/batch/grants`

인증: API 키 필요(`Authorization: Bearer <API Key>`).

소유한 여러 App을 한 번의 호출로 여러 사용자에게 공개합니다(행렬 의미, 멱등). 저장 방식과 적용 규칙은 단일 사용자 grant와 같습니다. 각 사용자 이름은 한 번만 확인됩니다. `granted`는 **새로운** 쌍만 계산하며, 이미 목록에 있는 쌍은 멱등하게 건너뛰므로 “3개 추가, 2개는 이미 있음”을 구분할 수 있습니다.

## 요청

### 요청 body

<ParamField body="app_names" type="string[]" required>
  —
</ParamField>

<ParamField body="usernames" type="string[]" required>
  사용자 이름 목록.
</ParamField>

### 요청 예시

```bash theme={null}
curl -X POST \
  -H "Authorization: Bearer $OCTOPARSE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"apps": ["carol/reviews-query", "carol/product-detail"], "usernames": ["dave", "erin"]}' \
  "https://api-datahub.octoparse.com/v1/data-apps/batch/grants"
```

## 응답

### 200 성공

```json theme={null}
{
  "data": {
    "granted": 3,
    "skipped": 1,
    "apps": [
      {
        "app": "carol/reviews-query",
        "ok": true
      },
      {
        "app": "carol/product-detail",
        "ok": true
      }
    ],
    "users": [
      {
        "username": "dave",
        "ok": true
      },
      {
        "username": "erin",
        "ok": true
      }
    ]
  }
}
```

페이로드는 `data`로 감쌉니다. 필드:

<ResponseField name="granted" type="integer" required>
  새로 생성된 grant 쌍의 수.
</ResponseField>

<ResponseField name="requested" type="integer" required>
  —
</ResponseField>

<ResponseField name="apps" type="object[]" required>
  App별 처리 결과.

  <Expandable title="fields">
    <ResponseField name="app_name" type="string" required>
      —
    </ResponseField>

    <ResponseField name="ok" type="boolean" required>
      —
    </ResponseField>

    <ResponseField name="code" type="string">
      —
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="users" type="object[]" required>
  사용자별 확인 결과.

  <Expandable title="fields">
    <ResponseField name="username" type="string" required>
      —
    </ResponseField>

    <ResponseField name="ok" type="boolean" required>
      —
    </ResponseField>

    <ResponseField name="code" type="string">
      —
    </ResponseField>
  </Expandable>
</ResponseField>

### 오류

| HTTP | `code`         | `category`  | 설명              |
| ---- | -------------- | ----------- | --------------- |
| 401  | `unauthorized` | `forbidden` | API 키 누락 또는 무효. |

오류 응답은 `{"error": {code, category, message, retryable}}`입니다. <a href="/docs/ko/datahub/api/reference/introduction#errors">오류</a> 참고.

## 클라이언트 라이브러리

Python / JavaScript SDK는 아직 이 엔드포인트를 감싸지 않습니다. REST를 직접 호출하세요.
