Diamra Developer Docs
All pages

Catalog

Your catalog is the Shopify store or product feed you connected in your Bench, under Branding. The API reads your products from it when you ask and keeps no copy of your photos: each product links to your store's own photo. The call takes your secret API key alone, with no customer token, since the catalog belongs to your store. A customer can then start a design from a product.

List products

Returns one page of your catalog, up to 24 products, best match first. Products with no photo are left out. A Shopify catalog shows only the collection and filters you chose when you connected it.

GEThttps://api.diamra.com/v1/catalog/products
HeaderWhat it is
Authorization
Required. Bearer and your secret API key. A publishable key gets a 403.

The parameters go in the query string. All are optional.

ParameterWhat it is
search
Words to look for in the products, up to 100 characters.
filter
The id of a value from filters, to keep only the products with that value. Repeat it for up to eight values.
page
The next_page from the last answer, for the page after it.
RequestShell
curl https://api.diamra.com/v1/catalog/products \  -H "Authorization: Bearer $DIAMRA_API_KEY"
ResponseHTTP
HTTP/2 200content-type: application/jsonrequest-id: req_9a4f1c7e03b85d26{  "object": "list",  "url": "/v1/catalog/products",  "has_more": true,  "next_page": "eyJsYXN0X2lkIjo4MTIzNDU2Nzg5MDE0fQ",  "filters": [    {      "label": "Product type",      "primary": true,      "values": [        {          "id": "eyJwcm9kdWN0VHlwZSI6IlJpbmdzIn0",          "label": "Rings"        },        {          "id": "eyJwcm9kdWN0VHlwZSI6IkVhcnJpbmdzIn0",          "label": "Earrings"        },        {          "id": "eyJwcm9kdWN0VHlwZSI6IlBlbmRhbnRzIn0",          "label": "Pendants"        }      ]    }  ],  "data": [    {      "object": "catalog_product",      "id": "8123456789012",      "title": "Oval Halo Engagement Ring",      "code": null,      "image_url": "https://cdn.shopify.com/s/files/1/0612/3458/9001/files/oval-halo.jpg?width=1600",      "thumbnail_url": "https://cdn.shopify.com/s/files/1/0612/3458/9001/files/oval-halo.jpg?width=800"    },    {      "object": "catalog_product",      "id": "8123456789013",      "title": "Hidden Halo Solitaire",      "code": null,      "image_url": "https://cdn.shopify.com/s/files/1/0612/3458/9001/files/hidden-halo.jpg?width=1600",      "thumbnail_url": "https://cdn.shopify.com/s/files/1/0612/3458/9001/files/hidden-halo.jpg?width=800"    },    {      "object": "catalog_product",      "id": "8123456789014",      "title": "Emerald Drop Earrings",      "code": null,      "image_url": "https://cdn.shopify.com/s/files/1/0612/3458/9001/files/emerald-drops.jpg?width=1600",      "thumbnail_url": "https://cdn.shopify.com/s/files/1/0612/3458/9001/files/emerald-drops.jpg?width=800"    }  ]}
FieldWhat it is
has_more
true when there's another page.
next_page
Send it as page to get the next page. null on the last page.
filters
Your store's own filters, such as product type or metal, each with a label and its values. primary is true for the one that sorts products by type. Sent on the first page when you send no search and no filter, and null on every other page.
data[].id
The product's id in your catalog. Send it as catalog_product.id to start a design.
data[].title
The product's name in your catalog.
data[].code
Your style number, such as S4069, when your catalog has one. null otherwise.
data[].image_url
A link to your store's own photo of the product, large.
data[].thumbnail_url
A smaller copy of the photo for a grid. The same link as image_url when your store has no smaller copy.

To narrow the list, send words, one or more filter values, or both:

Request with a search and a filterShell
curl -G https://api.diamra.com/v1/catalog/products \  -H "Authorization: Bearer $DIAMRA_API_KEY" \  -d search=oval \  -d filter=eyJwcm9kdWN0VHlwZSI6IlJpbmdzIn0

A product feed is read about once every six hours, so a new product can take that long to show. A Shopify catalog shows changes at once.

Start a design from a product

Send the product in reference_images when you create a design, as { "catalog_product": { "id": "..." } }. Diamra looks the product up in your catalog and the design follows its photo. Nothing is copied. A product and the customer's own images can go in the same list, up to ten in all.

RequestShell
curl https://api.diamra.com/v1/designs \  -H "Authorization: Bearer $DIAMRA_API_KEY" \  -H "Diamra-Customer-Token: $ACCESS_TOKEN" \  -H "Content-Type: application/json" \  -d '{    "prompt": "The same ring with a pear diamond",    "reference_images": [      {        "catalog_product": {          "id": "8123456789012"        }      }    ]  }'

Limits

Up to 120 calls a minute to List products for your store. Past that, the call answers a 429 rate_limit, with Retry-After: 60.

Errors

AnswerWhen
400 parameter_unknown
A parameter the call doesn't take, often a typo. param names it.
400 parameter_invalid
search is longer than 100 characters, page is empty or too long, or filter has more than eight values or one that isn't from filters. param names it.
401 api_key_invalid
No key, or one Diamra doesn't know. See API keys.
401 api_key_revoked
The key was revoked in your console.
403 secret_key_required
The call came with a publishable key. Use a secret key.
403 plan_required
Your store isn't on the Retail plan. Its keys work again once it is.
404 catalog_not_connected
Your store has no catalog. Connect one in your Bench, under Branding.
429 rate_limit
More than 120 calls in a minute for your store.
503 catalog_unavailable
Your store's Shopify or product feed didn't answer. Try again in a minute.
An errorHTTP
HTTP/2 404content-type: application/jsonrequest-id: req_5e2c8b1d74a09f36{  "error": {    "type": "invalid_request_error",    "code": "catalog_not_connected",    "message": "Your store has no catalog connected. Connect one in your Bench, under Branding."  }}