Diamra Developer Docs
All pages

Projects

A project is a piece your customer wants made, started from one of a design's images. It opens on your Bench, where your team takes it from an estimate to the finished piece. Your server creates a project when the customer picks an image, reads it back, lists and searches the customer's projects, and deletes one if they change their mind. Every call takes your API key and the customer's access token from Auth. Each project belongs to that customer, in your store. The API comes with the Retail plan.

Create a project

Starts a project from the image the customer picked. Its id is in the design's images, which Retrieve a design returns.

POSThttps://api.diamra.com/v1/projects
HeaderWhat it is
Authorization
Required. Bearer and your API key.
Diamra-Customer-Token
Required. The customer's access_token from Log in, Register or Refresh.
ParameterWhat it is
design_image
Required. The image the project is for, as an object.
design_image.id
Required. The image's id from the design's images.
RequestShell
curl https://api.diamra.com/v1/projects \  -H "Authorization: Bearer $DIAMRA_API_KEY" \  -H "Diamra-Customer-Token: $ACCESS_TOKEN" \  -H "Content-Type: application/json" \  -d '{    "design_image": {      "id": "6cae4081-3d5f-4b7c-9e1a-2f4d6b8cae32"    }  }'
ResponseHTTP
HTTP/2 201content-type: application/jsonrequest-id: req_1f8c3a6e94d27b05{  "id": "8d3e5b17-2f6a-4c9e-b0d4-7a1c9e2f6b58",  "design_image": {    "id": "6cae4081-3d5f-4b7c-9e1a-2f4d6b8cae32",    "url": "https://assets.diamra.com/design-images/3f6d1c2e-8a4b-4f0e-9b7a-2c5e8d1f4a90/2.webp"  }}

An image has one project. If the image has a project already, the call answers it with a 200 and starts nothing new. A new project sends the project.started webhook event, like every new project in your store. Diamra also emails your team about it, unless you turned that email off in Diamra Email Delivery.

Retrieve a project

Returns the project. Its views, the piece drawn from each side, and the measurements drawn on them have calls of their own.

GEThttps://api.diamra.com/v1/projects/{id}

Send the same two headers.

RequestShell
curl https://api.diamra.com/v1/projects/8d3e5b17-2f6a-4c9e-b0d4-7a1c9e2f6b58 \  -H "Authorization: Bearer $DIAMRA_API_KEY" \  -H "Diamra-Customer-Token: $ACCESS_TOKEN"
ResponseHTTP
HTTP/2 200content-type: application/jsonrequest-id: req_7b2e0c5d18f94a63{  "id": "8d3e5b17-2f6a-4c9e-b0d4-7a1c9e2f6b58",  "design_image": {    "id": "6cae4081-3d5f-4b7c-9e1a-2f4d6b8cae32",    "url": "https://assets.diamra.com/design-images/3f6d1c2e-8a4b-4f0e-9b7a-2c5e8d1f4a90/2.webp"  }}

Delete a project

Takes the project off the customer's projects. Nothing is lost: your store keeps it on your Bench, with its views and everything else made for it.

DELETEhttps://api.diamra.com/v1/projects/{id}

Send the same two headers.

RequestShell
curl -X DELETE https://api.diamra.com/v1/projects/8d3e5b17-2f6a-4c9e-b0d4-7a1c9e2f6b58 \  -H "Authorization: Bearer $DIAMRA_API_KEY" \  -H "Diamra-Customer-Token: $ACCESS_TOKEN"
ResponseHTTP
HTTP/2 200content-type: application/jsonrequest-id: req_6a0d4e2b71f93c58{  "id": "8d3e5b17-2f6a-4c9e-b0d4-7a1c9e2f6b58",  "deleted": true}

Deleting it again answers 404, and so does retrieving it. To bring it back, create a project from the same image: the same project comes back with its id, and its views and measurements are as they were.

List projects

Returns the customer's projects, newest first, one page at a time. Each one is the same object that Retrieve a project returns. Deleted projects aren't listed.

GEThttps://api.diamra.com/v1/projects

Send the same two headers. The parameters go in the query string, and each one is optional.

ParameterWhat it is
limit
How many projects to return, from 1 to 100. The default is 10.
starting_after
The id of the last project on the page you have. The next page starts after it.
search
Words to look for, up to 200 characters. A project matches when each word is in its design's prompt, or in the names of the options the customer picked in your studio. Case doesn't matter.
RequestShell
curl -G https://api.diamra.com/v1/projects \  -H "Authorization: Bearer $DIAMRA_API_KEY" \  -H "Diamra-Customer-Token: $ACCESS_TOKEN" \  -d limit=1 \  --data-urlencode "search=oval sapphire"
ResponseHTTP
HTTP/2 200content-type: application/jsonrequest-id: req_9c4a1e7f30b2d865{  "object": "list",  "url": "/v1/projects",  "has_more": true,  "data": [    {      "id": "9e4f6c28-3a7b-4d0f-8c1e-5b2d0a3f7c69",      "design_image": {        "id": "7dbf5192-4e6a-4c8d-af2b-3a5e7c9dbf43",        "url": "https://assets.diamra.com/design-images/3f6d1c2e-8a4b-4f0e-9b7a-2c5e8d1f4a90/3.webp"      }    }  ]}

has_more is true when more projects follow. For the next page, send the last project's id as starting_after, with the same limit and search.

The next pageShell
curl -G https://api.diamra.com/v1/projects \  -H "Authorization: Bearer $DIAMRA_API_KEY" \  -H "Diamra-Customer-Token: $ACCESS_TOKEN" \  -d limit=1 \  --data-urlencode "search=oval sapphire" \  -d starting_after=9e4f6c28-3a7b-4d0f-8c1e-5b2d0a3f7c69

When has_more is false, you have them all. A search that matches nothing returns an empty data list.

The project

Create a project and Retrieve a project answer it, and List projects returns a page of them in data. Delete a project answers its id and deleted: true.

FieldWhat it is
id
The project's id. Webhook events about the project carry it as project_id.
design_image.id
The image the project is for. Webhook events carry it as design_image_id.
design_image.url
A public link to the image, the same as in the design's images.

Limits

One customer
10 calls a minute to Create a project.
Your store
30 calls a minute to Create a project, and 120 to List projects.

Over a limit, the call answers a 429 rate_limit, with Retry-After: 60, and the message says which. Retrieve a project and Delete a project have no limit.

Errors

AnswerWhen
400 parameter_missing
No design_image, or no id in it. param names it.
400 parameter_unknown
A parameter the call doesn't take, often a typo. param names it.
400 parameter_invalid
design_image isn't an object, or its id isn't a well-formed id. For a list: limit isn't a whole number from 1 to 100, starting_after isn't a well-formed id, or search is over 200 characters. param names the one at fault.
400 resource_missing
design_image.id isn't an image of this customer's designs in your store, or starting_after isn't a project of theirs. The message gives the id.
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.
401 customer_token_invalid
No access token, or one that ran out or was never valid. Refresh the session, or log the customer in again.
403 access_pending
Your store approves new customers first and hasn't approved this one. Approve them under Customers in your Bench.
403 plan_required
Your store isn't on the Retail plan. Its keys work again once it is.
404 resource_missing
No project with this id belongs to this customer in your store, or it was deleted.
429 rate_limit
More than 10 calls to Create a project in a minute for one customer, or 30 for your store. More than 120 calls to List projects in a minute for your store.
503
The project couldn't be created. Try again in a minute.
An errorHTTP
HTTP/2 400content-type: application/jsonrequest-id: req_3c7e1b94a05d2f86{  "error": {    "type": "invalid_request_error",    "code": "resource_missing",    "message": "No design image 7c2e9a41-5d3b-4f8e-a1c6-0b9d4e2f8a73 of this customer in your store.",    "param": "design_image.id"  }}