Skip to main content

Get order keys

Returns all product keys for a given order. Use the order id returned from Create order.

Important: Keys are not available immediately after Create order: payment must finish first, and this endpoint only serves keys within 48 hours of order creation. Behavior for each case is summarized under Error responses below. Outside this endpoint, you can use the G2A Dashboard to retrieve keys without any time limit.

Key delivery time: Keys are typically ready within 5 minutes of order creation. In some cases delivery may take longer. If a key is not delivered within 5 hours, an automated refund will be issued.

Endpoint: GET /export/v1/orders/{orderId}/keys

Headers

HeaderRequiredDescription
AuthorizationYesBearer token obtained from the OAuth2 token endpoint. Format: Bearer <access_token>. See Authentication.

Path parameters

ParameterTypeRequiredDescription
orderIdstringYesOrder identifier (e.g. from create order response). Example: 92000000289147

Sandbox

curl 'https://sandboxapi.g2a.com/export/v1/orders/92000000316793/keys' \
--header 'Authorization: Bearer rfC3vIi6zoVqZSHAlhTXslTfvMZYwWPZ' \

Success response (200)

The response contains a data array of order item objects. Each element has an item object with the order item id, and a keys array; each key is an object with a code (the product key).

Standard

{
"data": [
{
"item": {
"id": "6992450"
},
"keys": [
{ "code": "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" },
{ "code": "YYYYY-YYYYY-YYYYY-YYYYY-YYYYY" }
]
}
]
}

Gift cards

Note: For gift card and random keys orders, the code value may be HTML-encoded. If it is, you have to decode the HTML entities before presenting it to the end user.

{
"data": [
{
"item": {
"id": "6992450"
},
"keys": [
{ "code": "&quot;Giftcard 1&quot;: &quot;XXX-XXX-XXX&quot;, &quot;PIN&quot;: &quot;1234&quot;, &quot;CVV&quot;: &quot;123&quot;" }
]
}
]
}

Random keys

{
"data": [
{
"item": {
"id": "6992450"
},
"keys": [
{ "code": "&quot;Game name&quot;: &quot;XXXXX-XXXXX-XXXXX&quot;; &quot;Game name&quot;: &quot;YYYYY-YYYYY-YYYYY&quot;" }
]
}
]
}

An order item represents the purchase of a single offer within an order. An order may contain multiple order items, potentially originating from different offers.

Currently, each order is limited to a single order item (one offer per order).

FieldTypeDescription
dataarrayList of order-item key groups
data[].itemobjectOrder item details associated with this entry
data[].item.idstringOrder item identifier
data[].keysarrayProduct keys for this order item
data[].keys[].codestringProduct key code

Error responses

Responses use the usual error object shape (code, message, status; see Error response format).

By HTTP status

HTTPerror.codeMeaning
400validation-errorInvalid orderId (e.g. wrong length, non-numeric), or another request validation failure mapped to this code.
400order-not-completeOrder exists for the caller but status is not completed yet (e.g. processing). Retry when the order is completed.
400order-expiredMore than 48 hours since order creation; keys are no longer returned by this endpoint.
402order-not-paidOrder is still pending (payment not finished). Retry after payment succeeds.
400order-not-foundNo order for this orderId, or it does not belong to the authenticated user.
410order-auto-refund-image-keysWhen a product key is available only as an image (and cannot be delivered as text via the API), we cancel the entire order and trigger a refund. You receive this response so you can treat the order as no longer valid and inform the buyer that a refund will be processed.
500internal-server-errorUnexpected server failure.