AIOZ Pin Operations
Interact with AIOZ Pin API quickly with API key authentication. A suite of integrated bash scripts is provided to automatically call REST APIs for pinning files, managing API keys, and tracking usage.
When to use this skill
- - User wants to pin files to IPFS or pin by CID hash
- User mentions "pin file", "pin to IPFS", "unpin", or "IPFS pinning"
- User wants to generate, list, or delete AIOZ Pin API keys
- User wants to retrieve pin details or list all pinned content
- User wants to check usage data, top-ups, or billing information
- User wants to manage AIOZ Pin resources
Authentication
This skill uses API key authentication via environment variables:
- -
PINNING_API_KEY: Your AIOZ Pin API key (provided by the platform) - INLINECODE1 : Your AIOZ Pin secret key (provided by the platform)
- INLINECODE2 : Your AIOZ Pin JWT token (for API key management operations)
Credential-safe policy:
- - Prefer credentials from secure environment injection.
- If missing, ask the user for credentials and set them as temporary environment variables.
- Never hardcode keys in command examples, logs, or responses.
- Avoid inline one-off commands that contain raw secrets.
⚠️ Critical Security Notice:
- - Never pass credentials as CLI arguments. Credentials passed as positional arguments become visible in
ps listings, shell history (.bash_history, .zsh_history), and process environment dumps. - All scripts must read credentials from environment variables only. Do not manually pass
PINNING_API_KEY, PINNING_SECRET_KEY, or AIOZ_JWT_TOKEN as script arguments. - If a script prompts for credentials or accepts them as arguments, that is a violation of this policy.
If credentials are not present in the shell session, set them once before running any scripts:
CODEBLOCK0
Header mapping used by scripts (credentials read from env vars internally):
- -
PINNING_API_KEY → pinning-api-key header - INLINECODE11 →
pinning-secret-key header - INLINECODE13 →
Authorization: Bearer header
This keeps credentials out of repeated command history and avoids accidental exposure.
Usage Options (Available Scripts)
When the user asks for a feature, use one of the bash scripts located in the scripts/ directory.
Prerequisite: All scripts read credentials from environment variables. Ensure these are set before executing any script:
CODEBLOCK1
Script Routing Map (for Clawbot)
All scripts below assume credentials are available in the environment (set via export). Do not pass credentials as CLI arguments.
Pinning Operations
- - Pin file by URL: INLINECODE17
- Pin by CID hash: INLINECODE18
- Get pin details: INLINECODE19
- List pins: INLINECODE20
- Unpin file: INLINECODE21
API Key Management (JWT)
- - Generate new API key: INLINECODE22
- List all API keys: INLINECODE23
- Delete API key: INLINECODE24
Usage & Billing
- - Get history usage data: INLINECODE25
- Get top-up data: INLINECODE26
- Get monthly usage data: INLINECODE27
1. Pin Files to IPFS
Use this script to pin a file by URL to IPFS:
CODEBLOCK2
Actual behavior in script:
- - Accepts public downloadable URL.
- Downloads file and pins to IPFS via AIOZ Pin service.
- Returns pin ID and CID hash.
2. Pin by CID Hash
To pin existing content by its IPFS CID:
CODEBLOCK3
- -
CID_HASH: The IPFS content hash to pin - INLINECODE29 : Optional name for the pinned content
3. API Key Management (JWT Flow)
Use these scripts to manage AIOZ Pin API keys:
CODEBLOCK4
Actual behavior in scripts:
- -
generate_api_key.sh calls POST /api/apikeys/create with permission flags. - Default permission values are
false if not provided. - INLINECODE33 calls
GET /api/apikeys and returns list of keys. - INLINECODE35 calls
DELETE /api/apikeys/{keyId} and removes the key.
4. Pin Details & Management
To inspect, list, and manage pins:
- - Get Pin Details: INLINECODE37
- Calls
GET /api/pinning/{pinId}
- Returns pin status, CID, size, creation date
- - List Pins: INLINECODE39
- Calls
GET /api/pinning/pins?offset=...&limit=...
- Defaults:
OFFSET=0,
LIMIT=10,
PINNED=true,
SORT_BY=name,
SORT_ORDER=ASC
- - Unpin File: INLINECODE46
- Calls
DELETE /api/pinning/unpin/{pinId}
- Removes pin from AIOZ Pin service
5. Usage & Billing Data
To retrieve usage and top-up data:
- - History Usage: INLINECODE48
- Calls
GET /api/usage/history?offset=...&limit=...
- Returns detailed usage history with timestamps
- - Top-up Data: INLINECODE50
- Calls
GET /api/usage/topup?offset=...&limit=...
- Returns top-up transaction history
- - Monthly Usage: INLINECODE52
- Calls
GET /api/usage/month?offset=...&limit=...
- Returns this month's usage statistics
Pagination notes:
- -
OFFSET default is INLINECODE55 - INLINECODE56 default is INLINECODE57
Full Pinning Flow (Common Operational Path)
For a typical pin lifecycle, use this sequence:
Setup: Ensure credentials are in the environment before executing any scripts:
CODEBLOCK5
Operational steps:
- 1. Pin a file or CID
- Get pin details to verify status
- List pins to check all pinned content
- Unpin when no longer needed
Step 1: Pin File by URL
CODEBLOCK6
Response: extract pinId and cid from the response.
Step 2: Check Pin Details
After pinning, verify the pin status:
CODEBLOCK7
Response includes: status (active/pending), CID, file size, created date.
Step 3: List All Pins
To see all pinned content:
CODEBLOCK8
Response: paginated list of all pins with metadata.
Step 4: Unpin Content
When done, remove the pin:
CODEBLOCK9
Confirms deletion.
Manual cURL Reference
(For reference only; prefer using provided scripts)
Prerequisites: These examples assume environment variables are set:
CODEBLOCK10
All credentials are referenced as $VARIABLE_NAME (shell expansion) — never hardcoded.
Pin File by URL
CODEBLOCK11
Generate API Key (JWT)
CODEBLOCK12
List Pins
CODEBLOCK13
Response Handling
- 1. Run the appropriate script from the
scripts/ directory. - Pin/Search scripts return raw JSON:
pin_files_or_directory, pin_by_cid, get_pin_details, INLINECODE65 - API Key scripts return structured output with key metadata and permissions
- Usage/Billing scripts return paginated data with timestamps and amounts
- Extract and return useful fields explicitly: pin IDs, CID hashes, status, URLs, balances. If pin status is
pending, inform the user to check again later.
Error Handling
- - 401 Unauthorized: Invalid API keys. Verify that
PINNING_API_KEY and PINNING_SECRET_KEY are correctly set in the environment (e.g., echo $PINNING_API_KEY). - Missing Parameters: Scripts validate arguments; pass exactly what they require.
- Credential exposure warnings: If you accidentally pass credentials as CLI arguments, immediately revoke those keys from your AIOZ Pin account and generate new ones. Credentials in commands are visible via
ps, shell history files, and process environment listings. - 404: Resource not found (invalid pin ID or key ID).
- 500: Server error; suggest retrying.
- Connection timeout/refused: API endpoint may be unavailable; retry and verify
https://api.aiozpin.network/api/ accessibility.
Example Interaction Flow
- 1. User: "Pin this file to IPFS"
- Verify environment setup: Confirm that
PINNING_API_KEY and PINNING_SECRET_KEY are already set in the shell environment. If missing, ask the user for their credentials and set them via:
export PINNING_API_KEY="..."
export PINNING_SECRET_KEY="..."
Do not pass these as script arguments.
- 3. Ask for the file URL
- Execute:
./scripts/pin_files_or_directory.sh "FILE_URL" (credentials come from environment) - Extract the returned pin ID and CID
- Return the pin information to the user
- Offer optional follow-up: check details (
get_pin_details.sh) or list pins (list_pins.sh)
AIOZ Pin 操作
通过API密钥认证快速与AIOZ Pin API交互。提供一套集成的bash脚本,用于自动调用REST API进行文件固定、API密钥管理和用量追踪。
何时使用此技能
- - 用户想要将文件固定到IPFS或通过CID哈希固定
- 用户提及固定文件、固定到IPFS、取消固定或IPFS固定
- 用户想要生成、列出或删除AIOZ Pin API密钥
- 用户想要检索固定详情或列出所有已固定内容
- 用户想要检查用量数据、充值或账单信息
- 用户想要管理AIOZ Pin资源
认证方式
此技能通过环境变量使用API密钥认证:
- - PINNINGAPIKEY:您的AIOZ Pin API密钥(由平台提供)
- PINNINGSECRETKEY:您的AIOZ Pin密钥(由平台提供)
- AIOZJWTTOKEN:您的AIOZ Pin JWT令牌(用于API密钥管理操作)
凭证安全策略:
- - 优先从安全环境注入获取凭证。
- 如果缺失,向用户请求凭证并将其设置为临时环境变量。
- 切勿在命令示例、日志或响应中硬编码密钥。
- 避免包含原始机密的内联一次性命令。
⚠️ 关键安全提示:
- - 切勿将凭证作为CLI参数传递。 作为位置参数传递的凭证会在ps列表、shell历史记录(.bashhistory、.zshhistory)和进程环境转储中可见。
- 所有脚本必须仅从环境变量读取凭证。 不要手动将PINNINGAPIKEY、PINNINGSECRETKEY或AIOZJWTTOKEN作为脚本参数传递。
- 如果脚本提示输入凭证或接受凭证作为参数,则违反此策略。
如果shell会话中不存在凭证,请在运行任何脚本前设置一次:
bash
export PINNINGAPIKEY=您的固定API密钥
export PINNINGSECRETKEY=您的固定密钥
export AIOZJWTTOKEN=您的JWT令牌 # 如果需要用于API密钥管理
脚本使用的标头映射(内部从环境变量读取凭证):
- - PINNINGAPIKEY → pinning-api-key标头
- PINNINGSECRETKEY → pinning-secret-key标头
- AIOZJWTTOKEN → Authorization: Bearer标头
这样可防止凭证出现在重复的命令历史中,并避免意外泄露。
使用选项(可用脚本)
当用户请求某项功能时,使用位于scripts/目录中的bash脚本。
先决条件: 所有脚本从环境变量读取凭证。在执行任何脚本前确保已设置这些变量:
bash
export PINNINGAPIKEY=您的密钥
export PINNINGSECRETKEY=您的密钥
export AIOZJWTTOKEN=您的JWT # 仅用于API密钥管理
脚本路由映射(适用于Clawbot)
以下所有脚本假定凭证在环境中可用(通过export设置)。切勿将凭证作为CLI参数传递。
固定操作
- - 通过URL固定文件:./scripts/pinfilesordirectory.sh 文件URL
- 通过CID哈希固定:./scripts/pinbycid.sh CID哈希 [元数据名称]
- 获取固定详情:./scripts/getpindetails.sh 固定ID
- 列出固定:./scripts/listpins.sh [偏移量] [限制数] [已固定] [排序字段] [排序顺序]
- 取消固定文件:./scripts/unpin_file.sh 固定ID
API密钥管理(JWT)
- - 生成新API密钥:./scripts/generateapikey.sh 密钥名称 [admin] [pinList] [nftList] [unpin] [pinByHash] [pinFileToIPFS] [unpinNFT] [pinNFTToIPFS]
- 列出所有API密钥:./scripts/getlistapikeys.sh
- 删除API密钥:./scripts/deleteapi_key.sh 密钥ID
用量与账单
- - 获取历史用量数据:./scripts/gethistoryusagedata.sh [偏移量] [限制数]
- 获取充值数据:./scripts/gettopup.sh [偏移量] [限制数]
- 获取月度用量数据:./scripts/getmonthusagedata.sh [偏移量] [限制数]
1. 将文件固定到IPFS
使用此脚本通过URL将文件固定到IPFS:
bash
./scripts/pinfilesor_directory.sh https://example.com/file.zip
脚本中的实际行为:
- - 接受可公开下载的URL。
- 下载文件并通过AIOZ Pin服务固定到IPFS。
- 返回固定ID和CID哈希。
2. 通过CID哈希固定
通过其IPFS CID固定现有内容:
bash
./scripts/pinbycid.sh QmHash... 可选名称
- - CID哈希:要固定的IPFS内容哈希
- 元数据名称:已固定内容的可选名称
3. API密钥管理(JWT流程)
使用这些脚本管理AIOZ Pin API密钥:
bash
生成带权限的API密钥:
./scripts/generate
apikey.sh my-key false true false false true true false false
列出API密钥:
./scripts/get
listapi_keys.sh
删除API密钥:
./scripts/delete
apikey.sh 密钥ID
脚本中的实际行为:
- - generateapikey.sh使用权限标志调用POST /api/apikeys/create。
- 如果未提供,默认权限值为false。
- getlistapikeys.sh调用GET /api/apikeys并返回密钥列表。
- deleteapi_key.sh调用DELETE /api/apikeys/{keyId}并删除密钥。
4. 固定详情与管理
检查、列出和管理固定:
- - 获取固定详情: ./scripts/getpindetails.sh 固定ID
- 调用GET /api/pinning/{pinId}
- 返回固定状态、CID、大小、创建日期
- - 列出固定: ./scripts/list_pins.sh [偏移量] [限制数] [已固定] [排序字段] [排序顺序]
- 调用GET /api/pinning/pins?offset=...&limit=...
- 默认值:偏移量=0,限制数=10,已固定=true,排序字段=name,排序顺序=ASC
- - 取消固定文件: ./scripts/unpin_file.sh 固定ID
- 调用DELETE /api/pinning/unpin/{pinId}
- 从AIOZ Pin服务移除固定
5. 用量与账单数据
检索用量和充值数据:
- - 历史用量: ./scripts/gethistoryusage_data.sh [偏移量] [限制数]
- 调用GET /api/usage/history?offset=...&limit=...
- 返回带时间戳的详细用量历史
- - 充值数据: ./scripts/gettopup.sh [偏移量] [限制数]
- 调用GET /api/usage/topup?offset=...&limit=...
- 返回充值交易历史
- - 月度用量: ./scripts/getmonthusage_data.sh [偏移量] [限制数]
- 调用GET /api/usage/month?offset=...&limit=...
- 返回本月用量统计
分页说明:
完整固定流程(常见操作路径)
对于典型的固定生命周期,使用以下顺序:
设置: 在执行任何脚本前确保凭证已在环境中:
bash
export PINNINGAPIKEY=您的密钥
export PINNINGSECRETKEY=您的密钥
操作步骤:
- 1. 固定文件或CID
- 获取固定详情以验证状态
- 列出固定以检查所有已固定内容
- 不再需要时取消固定
步骤1:通过URL固定文件
bash
./scripts/pinfilesor_directory.sh https://example.com/file.zip
响应:从响应中提取pinId和cid。
步骤2:检查固定详情
固定后,验证固定状态:
bash
./scripts/getpindetails.sh 固定ID
响应包括:状态(活跃/待处理)、CID、文件大小、创建日期。
步骤3:列出所有固定
查看所有已固定内容:
bash
./scripts/list_pins.sh 0 10 true name ASC
响应:所有固定的分页列表及元数据。
步骤4:取消固定内容
完成后,移除固定:
bash
./scripts/unpin_file.sh 固定ID
确认删除。
手动cURL参考
(仅供参考;建议使用提供的脚本)
先决条件: 这些示例假定已设置环境变量:
bash
export