Skip to content
トレカクラウド
Esc
↑↓navigate↵open⌘Jpreview

Send oripa demand

Send, per card and quality, the prizes won that have no unit assigned yet, the slots left in packs on sale, and how fast they are being won. The shop uses this to decide what to stock and boost. Stock does not change. Do not send customer information.

Each call replaces the connection’s whole demand: lines left out are removed, and an empty list clears it. It replaces only when generatedAt is newer than the stored one, returning { "applied": true, "lines": count }; when it is the same or older nothing changes and it returns { "applied": false }. A generatedAt more than 5 minutes ahead of the server clock is 422 invalid_generated_at.

Besides inventory:read, this needs the operation’s scope and the approving member’s inventory.write permission.

PUT/inventory/demand
Authorization
AuthorizationOAuth2 access token · headerrequired

Authorization code flow (PKCE S256 required). Send resource=https://api.toreca-cloud.com/partner/v1 with the authorization, token and refresh requests. Access tokens last 15 minutes; refresh tokens last 90 days and rotate on every refresh.

Scopes:inventory:readinventory:write
Request body
requiredapplication/json
generatedAtstring<date-time>required

When the partner worked out the demand

matches ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
linesobject[]required
max items 5000
Show properties
Array of object
keystringrequired

The partner's stable key

min length 1 · max length 200
cardIdstring<uuid> | nullrequired

Card catalog ID; null for an any-card line. Unknown IDs are stored as sent.

Show properties
Any of:
string<uuid>
string<uuid>
null
null
labelstringrequired

Display name

min length 1 · max length 200
criteriastring | nullrequired

What an any-card line accepts (game, rarity, set, language and so on)

Show properties
Any of:
string
string
null
null
ruleobject | null

What an any-card line accepts, as fields. Stock is counted only for lines that have one. Allowed only when cardId is null. Optional.

Show properties
Any of:
object
One of:
object
kindstringrequired
gameIdstring<uuid>required

Card catalog game ID

languageCodestringrequired

The card's language (ja, en, zh-Hans and so on)

min length 2 · max length 10
raritiesstring[]required

Rarity names accepted (as the card catalog names them); a card of any one fits

min items 1 · max items 50
setIdsstring<uuid>[]required

Sets accepted (card catalog set IDs); empty for every set

max items 200
null
null
partnerCodestring | null

The partner's own code for what the line asks for, shown to tell apart lines with the same label and criteria. Optional.

Show properties
Any of:
string
string
null
null
qualityobject | nullrequired

The quality; null for any.

Show properties
Any of:
object
One of:
object
kindstringrequired
conditionstringrequired
Allowed:mintnear_mintlightly_playedmoderately_playedheavily_playeddamaged
object
kindstringrequired
companystringrequired
min length 1 · max length 100
gradestringrequired
min length 1 · max length 100
null
null
shippingRequestedintegerrequired

Requested for shipping with no unit assigned

min 0 · max 1000000
heldintegerrequired

Held by customers with no unit assigned

min 0 · max 1000000
undrawnintegerrequired

Slots left in packs on sale with no unit held

min 0 · max 1000000
reservedintegerrequired

Units held for packs on sale, not yet drawn

min 0 · max 1000000
wins7dintegerrequired

Wins in the last 7 days

min 0 · max 1000000
wins30dintegerrequired

Wins in the last 30 days

min 0 · max 1000000
oldestRequestAtstring<date-time> | nullrequired

When the oldest unassigned shipping request was made

Show properties
Any of:
string<date-time>
string<date-time>
null
null
requestobject | nullrequired

A restock request to the shop

Show properties
Any of:
object
quantityintegerrequired
min 1 · max 1000000
notestring | nullrequired
Show properties
Any of:
string
string
null
null
requestedAtstring<date-time>required
matches ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
null
null
Responses
200

Accepted

One of:
object
appliedbooleanrequired
linesintegerrequired
min 0
object
appliedbooleanrequired
400

invalid_request: a parameter is invalid.

errorstringrequired

The error code. The main ones are below; more may be added.

  • 400: invalid_request (bad parameters or body), invalid_cursor
  • 401: invalid_token
  • 403: insufficient_scope, connection_revoked, client_disabled, forbidden, ip_not_allowed
  • 404: not_found
  • 409: conflict (updated at the same time; read again and retry), idempotency_conflict (a requestId reused for different content), receipt_not_confirmed (a purchase awaiting the customer's payment confirmation)
  • 422 units: unit_unavailable (not in stock), unit_not_allocated (not allocated to this partner), unit_not_found
  • 422 holds: invalid_expiry, hold_shipped, hold_cancelled, hold_confirmed, hold_blocked, sale_amount_required (neither a sale price nor a market value)
  • 422 listings and shipments: commitment_not_on_sale, commitment_not_allocated, commitment_shipping, commitment_blocked, commitment_closed, commitment_not_on_shipment, shipment_shipped, shipment_cancelled, shipment_not_shipped, shipment_blocked, shipment_refused
  • 422 moves: invalid_location, location_inactive, different_site, same_site, mixed_sites, invalid_site, site_inactive, wrong_site, unit_not_on_transfer, transfer_line_closed, unit_not_on_checkout, move_refused, transfer_refused, checkout_refused, return_refused
  • 422 other: invalid_webhook_url, invalid_generated_at
  • 429: rate_limited
  • 503: photo_unavailable
scopestring

With insufficient_scope, the missing scope

requestIdstring<uuid>
inventoryItemIdsstring<uuid>[]
holdIdsstring<uuid>[]
commitmentIdsstring<uuid>[]
401

invalid_token: the token is missing, expired, or for another resource.

errorstringrequired

The error code. The main ones are below; more may be added.

  • 400: invalid_request (bad parameters or body), invalid_cursor
  • 401: invalid_token
  • 403: insufficient_scope, connection_revoked, client_disabled, forbidden, ip_not_allowed
  • 404: not_found
  • 409: conflict (updated at the same time; read again and retry), idempotency_conflict (a requestId reused for different content), receipt_not_confirmed (a purchase awaiting the customer's payment confirmation)
  • 422 units: unit_unavailable (not in stock), unit_not_allocated (not allocated to this partner), unit_not_found
  • 422 holds: invalid_expiry, hold_shipped, hold_cancelled, hold_confirmed, hold_blocked, sale_amount_required (neither a sale price nor a market value)
  • 422 listings and shipments: commitment_not_on_sale, commitment_not_allocated, commitment_shipping, commitment_blocked, commitment_closed, commitment_not_on_shipment, shipment_shipped, shipment_cancelled, shipment_not_shipped, shipment_blocked, shipment_refused
  • 422 moves: invalid_location, location_inactive, different_site, same_site, mixed_sites, invalid_site, site_inactive, wrong_site, unit_not_on_transfer, transfer_line_closed, unit_not_on_checkout, move_refused, transfer_refused, checkout_refused, return_refused
  • 422 other: invalid_webhook_url, invalid_generated_at
  • 429: rate_limited
  • 503: photo_unavailable
scopestring

With insufficient_scope, the missing scope

requestIdstring<uuid>
inventoryItemIdsstring<uuid>[]
holdIdsstring<uuid>[]
commitmentIdsstring<uuid>[]
403

One of insufficient_scope, connection_revoked, client_disabled or forbidden.

errorstringrequired

The error code. The main ones are below; more may be added.

  • 400: invalid_request (bad parameters or body), invalid_cursor
  • 401: invalid_token
  • 403: insufficient_scope, connection_revoked, client_disabled, forbidden, ip_not_allowed
  • 404: not_found
  • 409: conflict (updated at the same time; read again and retry), idempotency_conflict (a requestId reused for different content), receipt_not_confirmed (a purchase awaiting the customer's payment confirmation)
  • 422 units: unit_unavailable (not in stock), unit_not_allocated (not allocated to this partner), unit_not_found
  • 422 holds: invalid_expiry, hold_shipped, hold_cancelled, hold_confirmed, hold_blocked, sale_amount_required (neither a sale price nor a market value)
  • 422 listings and shipments: commitment_not_on_sale, commitment_not_allocated, commitment_shipping, commitment_blocked, commitment_closed, commitment_not_on_shipment, shipment_shipped, shipment_cancelled, shipment_not_shipped, shipment_blocked, shipment_refused
  • 422 moves: invalid_location, location_inactive, different_site, same_site, mixed_sites, invalid_site, site_inactive, wrong_site, unit_not_on_transfer, transfer_line_closed, unit_not_on_checkout, move_refused, transfer_refused, checkout_refused, return_refused
  • 422 other: invalid_webhook_url, invalid_generated_at
  • 429: rate_limited
  • 503: photo_unavailable
scopestring

With insufficient_scope, the missing scope

requestIdstring<uuid>
inventoryItemIdsstring<uuid>[]
holdIdsstring<uuid>[]
commitmentIdsstring<uuid>[]
422

invalid_generated_at: generatedAt is more than 5 minutes ahead of the server clock.

errorstringrequired

The error code. The main ones are below; more may be added.

  • 400: invalid_request (bad parameters or body), invalid_cursor
  • 401: invalid_token
  • 403: insufficient_scope, connection_revoked, client_disabled, forbidden, ip_not_allowed
  • 404: not_found
  • 409: conflict (updated at the same time; read again and retry), idempotency_conflict (a requestId reused for different content), receipt_not_confirmed (a purchase awaiting the customer's payment confirmation)
  • 422 units: unit_unavailable (not in stock), unit_not_allocated (not allocated to this partner), unit_not_found
  • 422 holds: invalid_expiry, hold_shipped, hold_cancelled, hold_confirmed, hold_blocked, sale_amount_required (neither a sale price nor a market value)
  • 422 listings and shipments: commitment_not_on_sale, commitment_not_allocated, commitment_shipping, commitment_blocked, commitment_closed, commitment_not_on_shipment, shipment_shipped, shipment_cancelled, shipment_not_shipped, shipment_blocked, shipment_refused
  • 422 moves: invalid_location, location_inactive, different_site, same_site, mixed_sites, invalid_site, site_inactive, wrong_site, unit_not_on_transfer, transfer_line_closed, unit_not_on_checkout, move_refused, transfer_refused, checkout_refused, return_refused
  • 422 other: invalid_webhook_url, invalid_generated_at
  • 429: rate_limited
  • 503: photo_unavailable
scopestring

With insufficient_scope, the missing scope

requestIdstring<uuid>
inventoryItemIdsstring<uuid>[]
holdIdsstring<uuid>[]
commitmentIdsstring<uuid>[]
Try it
Server
Authorization
Bodyapplication/json
Request
curl -X PUT 'https://api.toreca-cloud.com/partner/v1/inventory/demand' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "generatedAt": "2019-08-24T14:15:22Z",
  "lines": [
    {
      "key": "string",
      "cardId": "f16ba382-eb42-481a-b08f-c57bdc9aae24",
      "label": "string",
      "criteria": "string",
      "rule": {
        "kind": "card",
        "gameId": "3f0eee32-8eac-4668-9b38-e3e5dc21d607",
        "languageCode": "string",
        "rarities": [
          "string"
        ],
        "setIds": [
          "497f6eca-6276-4993-bfeb-53cbbbba6f08"
        ]
      },
      "partnerCode": "string",
      "quality": {
        "kind": "raw",
        "condition": "mint"
      },
      "shippingRequested": 0,
      "held": 0,
      "undrawn": 0,
      "reserved": 0,
      "wins7d": 0,
      "wins30d": 0,
      "oldestRequestAt": "2019-08-24T14:15:22Z",
      "request": {
        "quantity": 1,
        "note": "string",
        "requestedAt": "2019-08-24T14:15:22Z"
      }
    }
  ]
}'
Response
{
  "applied": true,
  "lines": 0
}

Was this page helpful?