Skip to content
smallPict

サンドボックスモードでのテスト

sp_test_ キーを使用したクォータ消費ゼロのテスト環境、ローカル開発、エラーシミュレーション。

SmallPictには、ローカル開発、CI/CD自動テスト、ステージング環境向けに設計された 論理サンドボックス環境 が用意されています。

サンドボックスモードを使用すると、本番クォータを一切消費せず、本番アセットに影響を与えるリスクなく 画像最適化APIをテストできます。


サンドボックスAPIキーの取得方法

  1. SmallPictダッシュボード → API Keys にアクセスします。
  2. Create Sandbox Key をクリックします。
  3. sp_test_... 接頭辞(プレフィックス)を持つキーが生成されます(例: sp_test_9a8b7c6d5e4f...)。
  4. ペアとなるSecret Keyを安全に保存します。

サンドボックスの技術的保護仕様

sp_test_... キーでAPIが呼び出された際、システムは以下の制御を行います:

End-to-End Image Processing & Edge CDN Flow

Sub-50ms image optimization lifecycle from client upload to global edge delivery.

  1. 01

    Client Application

    WordPress / SDK / API

    Uploads raw image binary with HMAC-SHA256 signature and UUID v4 idempotency key.

    Origin Request

  2. 02

    smallPict Edge CDN

    Global Edge PoPs

    Checks global edge cache. On cache HIT, delivers AVIF/WebP in <20ms worldwide.

    Cache & Delivery

  3. 03

    SmallPict API Gateway

    Authentication & Quotas

    Validates HMAC credentials, verifies quota limits, and scopes access to customer_id.

    Auth & Scoping

  4. 04

    Optimization Engine

    High-Speed Native Encoder

    Multi-threaded quantization transcode to AVIF & WebP with no visible quality loss and much smaller files.

    Transcoding

  5. 05

    Secure Storage & Sync

    Encrypted Cloud Storage

    Stores optimized output, invalidates outdated cache tags, and warms the edge cache.

    Persistent Sync

Zero Data Interception: End-to-end HMAC validation & SHA256 integrity check

Engine: smallPict

  1. クォータ消費ゼロ: 課金サービスの減算処理がバイパスされるため、開発テストで有料クレジットが消費されることはありません。
  2. 一時ストレージ (24時間): 変換されたテスト画像は本番環境から分離された暗号化一時処理ストレージに保存され、24時間後に自動削除されます。
  3. レスポンスヘッダーによる識別: サンドボックスリクエストに対するすべてのレスポンスには、HTTPヘッダー X-SmallPict-Sandbox: true が含まれます。
  4. テストファイル上限: サンドボックスモードでは最大25MBまでの画像をテストできます。

サンドボックス環境でのSDK実装例

Node.js

TypeScript
import { SmallPict } from '@smallpict/sdk';import fs from 'node:fs';
const sandboxClient = new SmallPict({  apiKey: 'sp_test_1234567890abcdef...',  secretKey: 'sec_test_secret123...'});
const result = await sandboxClient.optimize(fs.readFileSync('sample.jpg'), {  format: 'avif',  quality: 80});
console.log('サンドボックス変換成功:', result.url);

cURL

Shell
curl -X POST https://api.smallpict.app/v1/optimize \  -H "X-API-Key: sp_test_1234567890abcdef..." \  -H "X-Timestamp: 1716301234" \  -H "X-Signature: 3a9f8b2c4d6e..." \  -H "Content-Type: application/json" \  -d {  "filename": "sample.jpg",  "mime_type": "image/jpeg",  "filesize": 500000,  "options": {    "format": "webp",    "quality": 80  }}'