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

# AceDataCloud プラットフォーム API 認証情報の作成

> Platform API guide - Ace Data Cloud

Application のビジネス API 認証情報を作成します。作成レスポンスには、`https://api.acedata.cloud/**` を直接呼び出せる Token、または Proxy タイプ認証情報のユーザー名/パスワードが含まれる場合があります。必ず秘密として扱ってください。

## 準備作業

1. [Account Token](https://platform.acedata.cloud/documents/platform-token) を作成します。
2. [Application リスト](https://platform.acedata.cloud/documents/platform-application-list)から、自分が所有する `application_id` を取得します。

```shell theme={null}
export PLATFORM_TOKEN='あなたのアカウントトークン'
export APPLICATION_ID='あなたの Application ID'
```

## インターフェース概要

| 項目 | 内容 |
| - | - |
| メソッド | `POST` |
| URL | `https://platform.acedata.cloud/api/v1/credentials/` |
| 認証 | Account Token、OAuth token には `credentials:write` が必要 |
| Body | JSON |

## リクエストボディ

| フィールド | 型 | 必須 | 説明 |
| - | - | - | - |
| `application_id` | UUID | はい | 対象 Application |
| `name` | string | いいえ | 認証情報の表示名 |
| `limited_amount` | number / null | いいえ | 単一認証情報の使用量上限。`null` は個別上限を設定しないことを示す |
| `expired_at` | datetime / null | いいえ | ISO 8601 の有効期限 |
| `allowed_api_ids` | UUID\[] / null | いいえ | これらの API のみ呼び出しを許可。空配列は制限なしに正規化される |
| `host` | string | いいえ | 認証情報の host 情報 |
| `for_user_id` | string | いいえ | Application 所有者が別のユーザーである場合に、認可認証情報を発行する際に使用 |
| `tags` / `metadata` | array / object | いいえ | カスタム拡張データ |

```shell theme={null}
curl -X POST 'https://platform.acedata.cloud/api/v1/credentials/' \
  -H "Authorization: Bearer ${PLATFORM_TOKEN}" \
  -H 'Content-Type: application/json' \
  -d "{\"application_id\":\"${APPLICATION_ID}\",\"name\":\"production\",\"limited_amount\":50}"
```

## レスポンス説明

成功時は `201` と Credential オブジェクトを返します。

* API/Agent タイプのサービスは通常、`type=Token` と `token` を返します。
* Proxy タイプのサービスは通常、`type=Identity` と `username` / `password` を返し、1 つの Proxy Application には 1 つの認証情報のみが許可されます。
* `id`、`user_id`、`creator_id`、`used_amount` および時間フィールドはサーバー側で生成されます。

現在のリストおよび詳細インターフェースも認証情報の平文を返しますが、クライアントはこの過去の動作に依存すべきではありません。作成後すぐに保存し、レスポンスをログに書き込まないでください。将来、インターフェースはマスキングされたレスポンスに変更される可能性があります。

## エラー処理

* `400`：フィールド形式エラー、不明な `allowed_api_ids`、Proxy Application に既存の認証情報がある場合、またはその他の作成制約。
* `401`：Account Token が無効です。
* `403/404`：対象 Application へのアクセス権がない、または Application/認可ユーザーが存在しません。

## 次のステップ

* [API 認証情報リストを取得する](https://platform.acedata.cloud/documents/platform-credential-list)
* [API 認証情報をローテーションする](https://platform.acedata.cloud/documents/platform-credential-rotate)
* [API 認証情報を削除する](https://platform.acedata.cloud/documents/platform-credential-delete)
* [呼び出し履歴を確認する](https://platform.acedata.cloud/documents/platform-usage-list)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.