# Panvaya: Sailing schedules

Public developer guide: https://panvaya.com/developers
OpenAPI 3.1 specification: https://api.panvaya.com/api/v1/openapi.json
Pricing and access: https://panvaya.com/pricing

These examples describe the public API contracts; they do not run requests.
Keep API keys server-side. Both test and live keys can contact real providers and consume credits.
Read the organization's configured product costs and limits before starting a billable workflow.
Example responses are illustrative snapshots, not current shipment or vessel observations.

## API pricing, access and integration

### How much does the Panvaya tracking API cost?
At public default rates, Tracking starts at $10 per 30 days with 20 shared Ocean/Air shipments and 1,200 API credits. Ocean tracking costs 2 credits per successful API response and Air tracking costs 5 by default, including cache hits. Organization-specific rates and product access remain authoritative; check the usage endpoint before a billable workflow.

### Do Web and API tracking use separate shipment allowances?
No. Ocean and Air tracking share one shipment allowance across Web and API. Web refreshes consume no API credits. Successful API calls consume the configured credits even when served from cache, while repeat API tracking of the same enrolled reference in one billing cycle does not add another distinct shipment. API errors are not billed.

### How do I get a container tracking API key?
Sign in to the Panvaya API Dashboard and select Create API key. Choose Sandbox (test) for development or Live for production. Send the key in the X-API-Key header from your server or integration backend. Store it in a secret manager or server-side environment variable.

### Does the sandbox return mock tracking data?
Sandbox keys use the same endpoints, response contracts and workspace limits as live keys. Tracking requests can contact real carriers and consume your workspace's credits and shipment allowance. Use the published JSON examples as fixtures for offline tests. Start with the unbilled GET /api/v1/usage request to verify your key and check available products, configured rates and remaining allowances before trying tracking.

### Are sailing schedules charged per sailing or per carrier?
The public default is 5 credits for each carrier returning usable sailings, regardless of how many sailings that carrier returns. Empty or failed carriers cost zero. Partial and cached results with usable sailings can be billable; your organization's configured price is authoritative.

### How do I connect Panvaya to a TMS or ERP?
Your backend or middleware keeps the API key server-side, calls the documented endpoints and maps the returned JSON to your own shipment records. The integration guide includes shared Ocean/Air request examples, field mappings and starter downloads. Scheduled Ocean webhooks and embedded tracking are also documented. These are integration building blocks, not a claim of a native vendor connector.

### Worked Ocean API example
100 ocean containers checked twice daily
100 containers × 2 checks/day × 30 days × 2 credits = 12,000 credits
At public defaults, 6,000 successful checks use all 12,000 credits in a $100 Tracking allocation. The 100 distinct references use 100 of its 200 shared shipment slots during one billing cycle.

## 1. General Architecture & Authentication
- **Base URL:** `https://api.panvaya.com/api/v1`
- **Authentication:** Pass the API key in the header:
  ```http
  X-API-Key: pv_live_your_key_here
  ```
  (Or as `Authorization: Bearer <key>`). Live keys are prefixed `pv_live_`; sandbox test keys are prefixed `pv_test_`.
- **Content-Type:** `application/json`
- **Rate Limits:** All API keys in one organization share a UTC-minute limit (Free 5, Enterprise 15 requests/minute by default). Each enabled product has a separate organization-wide cap (D&D Tariffs 20; Sailing Schedules 5; Ocean/Air Tracking 10; computational APIs 10; lightweight APIs 10 requests/minute by default). Admins may customize both.
  - Headers returned: `X-Request-Id`, `X-RateLimit-Limit`, `X-RateLimit-Remaining`, and for metered products `X-Product-RateLimit-Limit` and `X-Product-RateLimit-Remaining`.
  - `X-Request-Id` is optional on requests; if omitted, Panvaya generates it and returns it in the response.
  - When throttled, returns `HTTP 429 RATE_LIMIT_EXCEEDED` (organization) or `PRODUCT_RATE_LIMIT_EXCEEDED` (product) with a `Retry-After: <seconds>` header. Integrations should automatically wait and retry.
  - Higher rate limits are available for enterprise accounts on request. Contact Panvaya support to unlock a higher limit.
- **Error Envelope:**
  ```json
  {
    "errors": [
      {
        "code": "INVALID_REQUEST",
        "title": "Invalid request",
        "detail": "One of container, bol, or bk is required."
      }
    ]
  }
  ```
  Always branch on the stable string `code` (e.g. `INVALID_REQUEST`, `CARRIER_NOT_SUPPORTED`, `CARRIER_MAINTENANCE`, `NOT_FOUND`, `QUOTA_EXCEEDED`, `RATE_LIMIT_EXCEEDED`, `PRODUCT_RATE_LIMIT_EXCEEDED`, `RATE_LIMIT_UNAVAILABLE`, `UPSTREAM_ERROR`, `UPSTREAM_UNAVAILABLE`).

### 4) Sailing Schedules Search
- **Default billing:** 5 credits per carrier returning usable sailings, not per sailing. Multiple sailings from one carrier count as one unit. Carriers without usable sailings cost zero; partial or fallback results are billable when they contain usable sailings. Configured organization credit rates remain authoritative.
- **Method & Path:** `POST /api/v1/schedules/search`
- **Request Body (JSON):**
  - `origin` (string, required): Origin UN/LOCODE (e.g. `"CNSHA"`).
  - `destination` (string, required): Destination UN/LOCODE (e.g. `"NLRTM"`).
  - `date` (string, optional): Earliest departure in `YYYY-MM-DD` (defaults to today).
  - `weeks` (integer, optional, default 4, min 1, max 12): Forward search horizon in weeks. Prunes carrier open-windows strictly to `[date, date + (weeks * 7) days]`.
  - `carriers` (array of string, optional): Filter by carrier names or SCACs (e.g. `["MAEU"]`).
- **Example 200 OK Response:**
```json
{
  "origin": {
    "name": "Shanghai",
    "locode": "CNSHA",
    "timezone": "Asia/Shanghai"
  },
  "destination": {
    "name": "Rotterdam",
    "locode": "NLRTM",
    "timezone": "Europe/Amsterdam"
  },
  "fromDate": "2025-09-01",
  "weeks": 8,
  "carriers": [
    "MAERSK"
  ],
  "successfulCarriers": [
    "MAERSK"
  ],
  "cached": true,
  "servedAt": "2025-09-01T11:25:00Z",
  "carrierStatuses": {
    "MAEU": {
      "carrier": "MAERSK",
      "carrierCode": "MAEU",
      "status": "FOUND",
      "count": 2,
      "cached": true,
      "cacheExpiresAt": "2025-09-01T20:00:00Z",
      "durationMs": 420.5
    }
  },
  "sailings": [
    {
      "carrier": "MAERSK",
      "carrierCode": "MAEU",
      "service": "AE1",
      "direct": true,
      "routingType": "Direct",
      "transshipments": 0,
      "originName": "Shanghai",
      "originLocode": "CNSHA",
      "originTerminal": "Yangshan Deepwater Port",
      "originTimezone": "Asia/Shanghai",
      "destinationName": "Rotterdam",
      "destinationLocode": "NLRTM",
      "destinationTerminal": "APM Terminals Maasvlakte II",
      "destinationTimezone": "Europe/Amsterdam",
      "retrievedAt": "2025-09-01T08:00:00Z",
      "cached": true,
      "sourceUpdatedAt": null,
      "sourceResultTimestamp": null,
      "sourceIdentifier": "carrier:MAEU",
      "departure": "2025-09-03T18:00:00+08:00",
      "arrival": "2025-10-05T06:00:00+02:00",
      "finalEtaStatus": "PUBLISHED",
      "transitTime": "32 days",
      "transitHours": 756,
      "vesselName": "MADRID MAERSK",
      "vesselImo": "9778791",
      "voyageNo": "2501W",
      "legs": [
        {
          "sequence": 1,
          "transportMode": "VESSEL",
          "vesselName": "MADRID MAERSK",
          "vesselImo": "9778791",
          "voyageNo": "2501W",
          "service": "AE1",
          "fromName": "Shanghai",
          "fromLocode": "CNSHA",
          "fromTerminal": "Yangshan Deepwater Port",
          "fromTimezone": "Asia/Shanghai",
          "departure": "2025-09-03T18:00:00+08:00",
          "toName": "Rotterdam",
          "toLocode": "NLRTM",
          "toTerminal": "APM Terminals Maasvlakte II",
          "toTimezone": "Europe/Amsterdam",
          "arrival": "2025-10-05T06:00:00+02:00",
          "transitHours": 756
        }
      ]
    },
    {
      "carrier": "MAERSK",
      "carrierCode": "MAEU",
      "service": "AE1",
      "direct": true,
      "routingType": "Direct",
      "transshipments": 0,
      "originName": "Shanghai",
      "originLocode": "CNSHA",
      "originTerminal": "Yangshan Deepwater Port",
      "originTimezone": "Asia/Shanghai",
      "destinationName": "Rotterdam",
      "destinationLocode": "NLRTM",
      "destinationTerminal": "APM Terminals Maasvlakte II",
      "destinationTimezone": "Europe/Amsterdam",
      "retrievedAt": "2025-09-01T08:00:00Z",
      "cached": true,
      "sourceUpdatedAt": null,
      "sourceResultTimestamp": null,
      "sourceIdentifier": "carrier:MAEU",
      "departure": "2025-09-10T12:00:00+08:00",
      "arrival": "2025-10-12T08:00:00+02:00",
      "finalEtaStatus": "PUBLISHED",
      "transitTime": "32 days",
      "transitHours": 764,
      "vesselName": "MUNICH MAERSK",
      "vesselImo": "9778806",
      "voyageNo": "2502W",
      "legs": [
        {
          "sequence": 1,
          "transportMode": "VESSEL",
          "vesselName": "MUNICH MAERSK",
          "vesselImo": "9778806",
          "voyageNo": "2502W",
          "service": "AE1",
          "fromName": "Shanghai",
          "fromLocode": "CNSHA",
          "fromTerminal": "Yangshan Deepwater Port",
          "fromTimezone": "Asia/Shanghai",
          "departure": "2025-09-10T12:00:00+08:00",
          "toName": "Rotterdam",
          "toLocode": "NLRTM",
          "toTerminal": "APM Terminals Maasvlakte II",
          "toTimezone": "Europe/Amsterdam",
          "arrival": "2025-10-12T08:00:00+02:00",
          "transitHours": 764
        }
      ]
    }
  ]
}
```
- **Carrier failure outcomes:** All carrier acquisition failures return HTTP 200 with their reasons in carrierStatuses, including location misses, network/timeout/CAPTCHA/proxy failures, parsing errors and incomplete coverage. Empty sailings with FAILED, TIMEOUT or PARTIAL carrier status is not confirmed no service and consumes zero credits for the affected carriers. Carriers returning usable sailings are billable, including PARTIAL_UPSTREAM and stale-cache rows; carriers returning zero usable sailings remain unbilled. Healthy complete empty or filtered-only results retain HTTP 404; request validation, authentication, entitlement, quota and rate-limit errors retain HTTP error statuses.
- **Reading the response:** `servedAt` is response assembly time; each sailing's `retrievedAt` is Panvaya's carrier capture time, and its `cached` flag identifies cache use even when the aggregate `cached` flag is false. A carrier status with usable data includes `cacheExpiresAt`, the original acquisition time plus the 12-hour freshness window; cache reads do not extend it. `sourceUpdatedAt` is set only from a verified carrier schedule-update timestamp; MSC's raw `sourceResultTimestamp` is a result-generation time, not a schedule revision. If the final destination `arrival` is null, `finalEtaStatus` is `NOT_PUBLISHED`; never replace it with an intermediate-leg arrival.

## Asynchronous batch sailing schedules
Available when asynchronous schedules are enabled for the deployment. Up to 2 active batch requests per organization by default. Contact support for higher limits.
### POST /api/v1/schedules/requests
Returns 202 with a request UUID, statusUrl, resultUrl and deadline. One port-to-port route per batch; omit carriers to select all enabled providers. Idempotency-Key is optional and must be reused only with the same request parameters.

```bash
curl -X POST "https://api.panvaya.com/api/v1/schedules/requests" \
  -H "X-API-Key: pv_live_your_key_here" \
  -H "Idempotency-Key: customer-search-123" \
  -H "Content-Type: application/json" \
  -d '{"origin":"CNSHA","destination":"NLRTM","weeks":4,"carriers":["MAEU","ONEY","HLCU"]}'
```

### GET /api/v1/schedules/requests/{requestId}
Returns 200 with progress, totalCarriers, terminalCarriers and each carrier's state, attempts and outcome. Terminal carriers include completed, partial, failed and timed-out carriers; this is not the billable-carrier count.

```bash
curl "https://api.panvaya.com/api/v1/schedules/requests/<requestId>" \
  -H "X-API-Key: pv_live_your_key_here"
```

### GET /api/v1/schedules/requests/{requestId}/result
Returns 202 progress while pending, then 200 with requestId, status, creditsCharged, metadata and result. The normalized result contains sailings and carrierStatuses; metadata includes chargedCarrierCodes and requestId. Partial results retain completed carrier data.

```bash
curl "https://api.panvaya.com/api/v1/schedules/requests/<requestId>/result" \
  -H "X-API-Key: pv_live_your_key_here"
```

### POST /api/v1/schedules/requests/{requestId}/retry-billing
After resolving a BILLING_FAILED issue, returns 202 and retries settlement using the collected results. It does not repeat carrier acquisition. Result access returns 409 until billing succeeds.

```bash
curl -X POST "https://api.panvaya.com/api/v1/schedules/requests/<requestId>/retry-billing" \
  -H "X-API-Key: pv_live_your_key_here"
```

202 acknowledgement:
```json
{
  "requestId": "a5b80a55-62a2-4935-92fd-ef3089cd90a6",
  "status": "CREATED",
  "createdAt": "2026-10-25T10:00:00Z",
  "deadlineAt": "2026-10-25T10:05:00Z",
  "statusUrl": "/api/v1/schedules/requests/a5b80a55-62a2-4935-92fd-ef3089cd90a6",
  "resultUrl": "/api/v1/schedules/requests/a5b80a55-62a2-4935-92fd-ef3089cd90a6/result"
}
```

- Up to 2 active batch requests per organization by default. Contact support for higher limits.
- Exceeding the active-request limit returns 429 ASYNC_SCHEDULE_CAPACITY_EXCEEDED. Wait for an active request to finish before submitting another batch.
- The five-minute budget includes queue wait, preparation and retries. Acquisition stops at 295 seconds to allow settlement. Consumer or database outages can delay final visibility; later carrier results cannot change a closed request.
- The default outer limit is 2 total execution attempts for retryable failures, including the first attempt. PARTIAL / PARTIAL_UPSTREAM responses are final and are not retried by the async worker. Individual carrier adapters retain their own internal retry policies.
- Poll no faster than Retry-After (15 seconds by default). Status and result reads share a separate 30 requests/minute organization allowance and do not charge credits.
- Uses SAILING_SCHEDULES pricing. No credits are reserved. Nonempty complete and partial carrier responses are charged, including partial stale-cache fallback. Empty responses and failures without usable sailings are unbilled. Partial flags remain visible; a charge does not certify complete route coverage. Existing fixed-price agreements remain supported until retired.
- Fresh exact windows are reused first; subsets of fresh wider windows keep the original acquisition time. Historical result reads remain stable after later cache refreshes.
- Request IDs, collected results and idempotency records have no automatic expiry. Retrieve an existing request using an authorized API key for its organization and live/sandbox environment. Use a new idempotency key for a new search.
- States: CREATED, PREPARING, RUNNING, FINALIZING, COMPLETED, PARTIAL, FAILED, BILLING_FAILED. Healthy empty results return COMPLETED with zero sailings and zero credits.
- API keys stay in request headers. Responses and queue messages contain no API key. Access is scoped to the organization and live/sandbox environment; responses are private, no-store.
Support: https://panvaya.com/contact-us


Full guide: https://panvaya.com/developers/docs.md
