> For the complete documentation index, see [llms.txt](https://docs.tracr.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tracr.com/api-reference/grading-integration-service-gis-api/upload-grading-data.md).

# Upload Grading Data

## What is it?

Once a diamond has been validated against the record Tracr holds, the lab can either upload the grading report with the grading data or upload the inscription number only that is associated with the diamond.

## Add diamond grading report and grading data

### How does it work?

The lab submits a POST request to `/v2/diamonds/{diamond_id}/certificate` ([reference](https://docs.tracr.com/api-reference/grading-integration-service-gis-api/references/api-v2.md#post-v2-diamonds-diamond_id-certificate)) with the required and recommended fields.

> **Required Data**
>
> **Required Fields**
>
> * Tracr ID
> * Certificate File
>
> **Recommended Fields**
>
> * Graded Date
> * Grader Report Number
> * Grader Report Comments
> * Grader Clarity Characteristics
> * Carat Weight
> * Clarity
> * Colour
> * Cut Grade
> * Measurement Text
> * Polish Quality
> * Shape
> * Symmetry
>
> **Optional Fields**
>
> * Crown Angle
> * Crown Height
> * Culet Condition
> * Culet Size
> * Depth
> * Depth Percent
> * Diameter Maximum
> * Diameter Minimum
> * Fancy Colour
> * Fancy Colour Intensity
> * Fancy Colour Overtone
> * Fluorescence Colour
> * Fluorescence Intensity
> * Girdle Condition
> * Girdle Thickness From
> * Girlde Thickness To
> * Length
> * Pavillion Angle
> * Pavillion Percent
> * Table Percent
> * Width

Call `POST /v2/diamonds/{diamond_id}/certificate`

{% tabs %}
{% tab title="Form-data" %}

| Key                              | Value                         |
| -------------------------------- | ----------------------------- |
| certificate\_file                | sample\_report.pdf            |
| graded\_date                     | 2024-05-31T11:54:28.033+01:00 |
| grader\_report\_no               | 214143811C                    |
| grader\_report\_comments         | sample                        |
| grader\_inscription\_no          | 214143811C                    |
| grader\_clarity\_characteristics | Crystal                       |
| carats                           | 0.52                          |
| clarity                          | VS2                           |
| colour                           | H                             |
| cut\_grade                       | EX                            |
| measurement\_text                | 5.10 - 5.12 x 3.18 mm         |
| polish\_quality                  | EX                            |
| shape                            | Round                         |
| symmetry                         | VG                            |
| {% endtab %}                     |                               |

{% tab title="Response" %}
{% code title="Response (201)" %}

```json
{
    "hash": "0ffa6a2313fff5db0048d47432a89615185873f08feeab5985451adac3a49930",
    "graded_measurement_id": "to55jz1yoiaoqyb34rmhi5n2"
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

### HTTP response status code

#### 201 : Success

Returned when the request has been successfully processed.

#### 404 : Not Found

Returned when a Diamond is not found in the Tracr network.

```json
{
    "detail": "Diamond cannot be found in Tracr"
}
```

#### 406 : Not Acceptable

Returned when certificate\_file is not an application/pdf file.

```json
{
    "detail": "certificate_file must have a mimetype of application/pdf."
}
```

#### 409 : Conflict

Returned when a given grading report has already been uploaded for a given diamond.

```json
{
    "detail": "Unable to upload certificate to Tracr instance: Another operation is in progress on one or more of the diamonds in this request."
}
```

#### 422 : Unprocessable Entity

Returned when the request doesn't match the endpoint data requirements.

```json
{
    "detail": [
        {
            "loc": [
                "certificate_file"
            ],
            "msg": "field required",
            "type": "value_error.missing"
        }
    ]
}
```

#### 500 : Internal Server Error

Returned when an internal error occurred within GIS. Please contact Tracr Support if you meet with this issue.

***

## Add diamond inscription number

Submit a POST request to `/v2/diamonds/{diamond_id}/inscription-number` ([reference](https://docs.tracr.com/api-reference/grading-integration-service-gis-api/references/api-v2.md#post-v2-diamonds-diamond_id-inscription-number)) to update the inscription number.

{% hint style="info" %}
GIS currently allows the lab to add an inscription number after a diamond passes verification. We recommend the lab to add a step to confirm the diamond has been validated before calling the update inscription API. This will be enforced by Tracr soon.
{% endhint %}

Example:

Call `POST /v2/diamonds/kzsrfx4dxupa7a8uyn15wund/inscription-number`

{% tabs %}
{% tab title="Request" %}
{% code title="Request Body" %}

```json
{
  "inscription_number": "247603711C",
  "inscription_date": "2024-12-10T09:29:46.550Z"
}
```

{% endcode %}
{% endtab %}

{% tab title="Response" %}
{% code title="Response (201)" %}

```json
{
    "hash": "2d130cfa113e4c7cb6df32b30a7225c083364be63415894e03e391ff4fb2deb1"
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

### HTTP response status code

#### 201 : Success

Returned when the request has been successfully processed.

#### 404 : Not Found

Returned when a Diamond is not found in the Tracr network.

```json
{
    "detail": "Diamond cannot be found in Tracr"
}
```

#### 409 : Conflict

Returned when a given inscription number has already been uploaded for a given diamond.

```json
{
    "detail": "Unable to add inscription number to diamond: Inscription number 2476037113 has already been added to diamond kzsrfx4dxupa7a8uyn15wund"
}
```

#### 422 : Unprocessable Entity

Returned when the request doesn't match the endpoint data requirements.

```json
{
    "detail": [
        {
            "loc": [
                "body",
                "inscription_date"
            ],
            "msg": "invalid datetime format",
            "type": "value_error.datetime"
        }
    ]
}
```

#### 500 : Internal Server Error

Returned when an internal error occurred within GIS. Please contact Tracr Support if you meet with this issue.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.tracr.com/api-reference/grading-integration-service-gis-api/upload-grading-data.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
