Skip to content

Quickstart

  1. Get a service credential

    The ZGI platform team issues credentials. A credential starts with zsk_ and is shown once. Keep it in your server-side secret store, never in source control or a browser.

    终端窗口
    export ZGI_SERVICES_TOKEN='zsk_...'
  2. List the capabilities you can use

    终端窗口
    curl -sS https://services.zgi.im/v1/services \
    -H "Authorization: Bearer $ZGI_SERVICES_TOKEN"

    capabilities contains only those your credential is scoped for and that have an available provider. Each lists its providers and their limits.

  3. Make a first call

    Classify the days of China’s 2026 National Day holiday. You generate invocation_id; use a new value for each business call.

    终端窗口
    curl -sS https://services.zgi.im/v1/public-holiday-queries \
    -H "Authorization: Bearer $ZGI_SERVICES_TOKEN" \
    -H 'Content-Type: application/json' \
    -d '{"invocation_id":"order-10086-1","provider":"holiday-cn","region":"CN","start_date":"2026-10-01","end_date":"2026-10-08"}'

    The response has two parts: execution records this execution (outcome and usage) and result holds the answer.

    {
    "code": 0,
    "message": "success",
    "data": {
    "execution": {
    "id": "exe_01a12e52b912717faddb9b0372c2d034",
    "invocation_id": "order-10086-1",
    "outcome": "succeeded",
    "usage": { "provider_requests": 0, "units": [{ "name": "days", "value": 8, "source": "measured" }] }
    },
    "result": {
    "region": "CN",
    "days": [{ "date": "2026-10-01", "day_type": "public_holiday", "is_off_day": true, "holiday_name": "国庆节" }],
    "totals": { "workdays": 1, "off_days": 7 }
    }
    }
    }
  4. Call again with the same id

    Repeating an invocation_id returns 409 EXECUTION.DUPLICATE_INVOCATION with the original execution, and the provider is not called again. A network retry can never be charged twice.

  5. Find it in the call log

    终端窗口
    curl -sS "https://services.zgi.im/v1/executions?invocation_id=order-10086-1" \
    -H "Authorization: Bearer $ZGI_SERVICES_TOKEN"