Node.js
import Shoply from "@shoplygg/node";
const shoply = new Shoply({ apiKey: process.env.SHOPLY_API_KEY });
const page = await shoply.stock.listKeys("VARIANT_ID");
// Or every row of every page:
for await (const row of shoply.stock.listKeys("VARIANT_ID")) {
console.log(row);
}<?php
require 'vendor/autoload.php';
$shoply = new Shoply\Client(['apiKey' => getenv('SHOPLY_API_KEY')]);
$page = $shoply->stock->listKeys('VARIANT_ID');
// Or every row of every page:
foreach ($shoply->stock->listKeys('VARIANT_ID') as $row) {
print_r($row);
}
import shoply
client = shoply.Client() # reads SHOPLY_API_KEY
page = client.stock.listKeys("VARIANT_ID")
# Or every row of every page:
for row in client.stock.listKeys("VARIANT_ID"):
print(row)
curl --request GET \
--url https://api.shoply.gg/v1/stores/{storeId}/variants/{variantId}/keys \
--header 'Authorization: Bearer <token>'package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.shoply.gg/v1/stores/{storeId}/variants/{variantId}/keys"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.shoply.gg/v1/stores/{storeId}/variants/{variantId}/keys")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.shoply.gg/v1/stores/{storeId}/variants/{variantId}/keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"success": true,
"message": null,
"code": null,
"data": [
{
"id": "21ff1752-ff41-4756-8bab-7c7afa682b54",
"value": "NWPRO-7F3K-22LM-9QXA"
},
{
"id": "a10a976c-3411-4c2d-ab44-b5b9161553b7",
"value": "NWPRO-B81C-K0PD-44TZ"
}
],
"pages": 1,
"meta": {
"shown": 3,
"matching": 3,
"page": 1,
"perPage": 100,
"maxPage": 5000,
"available": 3,
"stock": "cacff173ff930c03b8e02b235adfbcbfbe48712a"
}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}Stock
List a variant's license keys
The license keys a variant has in stock: the unsold ones and nothing else. A key that was delivered belongs to its order and is read there.
Needs the stock.read permission (Read Stock).
GET
/
stores
/
{storeId}
/
variants
/
{variantId}
/
keys
Node.js
import Shoply from "@shoplygg/node";
const shoply = new Shoply({ apiKey: process.env.SHOPLY_API_KEY });
const page = await shoply.stock.listKeys("VARIANT_ID");
// Or every row of every page:
for await (const row of shoply.stock.listKeys("VARIANT_ID")) {
console.log(row);
}<?php
require 'vendor/autoload.php';
$shoply = new Shoply\Client(['apiKey' => getenv('SHOPLY_API_KEY')]);
$page = $shoply->stock->listKeys('VARIANT_ID');
// Or every row of every page:
foreach ($shoply->stock->listKeys('VARIANT_ID') as $row) {
print_r($row);
}
import shoply
client = shoply.Client() # reads SHOPLY_API_KEY
page = client.stock.listKeys("VARIANT_ID")
# Or every row of every page:
for row in client.stock.listKeys("VARIANT_ID"):
print(row)
curl --request GET \
--url https://api.shoply.gg/v1/stores/{storeId}/variants/{variantId}/keys \
--header 'Authorization: Bearer <token>'package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.shoply.gg/v1/stores/{storeId}/variants/{variantId}/keys"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.shoply.gg/v1/stores/{storeId}/variants/{variantId}/keys")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.shoply.gg/v1/stores/{storeId}/variants/{variantId}/keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"success": true,
"message": null,
"code": null,
"data": [
{
"id": "21ff1752-ff41-4756-8bab-7c7afa682b54",
"value": "NWPRO-7F3K-22LM-9QXA"
},
{
"id": "a10a976c-3411-4c2d-ab44-b5b9161553b7",
"value": "NWPRO-B81C-K0PD-44TZ"
}
],
"pages": 1,
"meta": {
"shown": 3,
"matching": 3,
"page": 1,
"perPage": 100,
"maxPage": 5000,
"available": 3,
"stock": "cacff173ff930c03b8e02b235adfbcbfbe48712a"
}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}Authorizations
A secret API key, made under Developers in the dashboard: Authorization: Bearer shoply_sk_...
Path Parameters
The store's ID. A key reaches the store it was made in: GET /key answers which.
The variant, as a product's variants name it.
Query Parameters
Which page of the list. The first is 1.
How many a page holds, up to 5,000.
Only keys that contain this.

