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
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer token obtained from the OAuth2 token endpoint. Format: Bearer <access_token>. See Authentication. |
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
orderId | string | Yes | Order 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": ""Giftcard 1": "XXX-XXX-XXX", "PIN": "1234", "CVV": "123"" }
]
}
]
}
Random keys
{
"data": [
{
"item": {
"id": "6992450"
},
"keys": [
{ "code": ""Game name": "XXXXX-XXXXX-XXXXX"; "Game name": "YYYYY-YYYYY-YYYYY"" }
]
}
]
}
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).
| Field | Type | Description |
|---|---|---|
data | array | List of order-item key groups |
data[].item | object | Order item details associated with this entry |
data[].item.id | string | Order item identifier |
data[].keys | array | Product keys for this order item |
data[].keys[].code | string | Product key code |
Error responses
Responses use the usual error object shape (code, message, status; see Error response format).
By HTTP status
| HTTP | error.code | Meaning |
|---|---|---|
| 400 | validation-error | Invalid orderId (e.g. wrong length, non-numeric), or another request validation failure mapped to this code. |
| 400 | order-not-complete | Order exists for the caller but status is not completed yet (e.g. processing). Retry when the order is completed. |
| 400 | order-expired | More than 48 hours since order creation; keys are no longer returned by this endpoint. |
| 402 | order-not-paid | Order is still pending (payment not finished). Retry after payment succeeds. |
| 400 | order-not-found | No order for this orderId, or it does not belong to the authenticated user. |
| 410 | order-auto-refund-image-keys | When 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. |
| 500 | internal-server-error | Unexpected server failure. |