> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://dev.rechain.co/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://dev.rechain.co/_mcp/server.

# Add a new quality control

POST https://api.rechain.co/public/v1/quality_controls
Content-Type: application/json

Add a new quality control

Reference: https://dev.rechain.co/api-reference/quality-control/add-a-new-quality-control

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Body (application/json)

This endpoint expects a QualityControlCreate.

- `qualityControl` (QualityControlBase, optional)

## Response

### 200

Successful operation

- `acknowledgedDefectsIdentified` (boolean, optional)
- `actualInspectionDate` (datetime, optional)
- `approved` (boolean, optional)
- `company` (QualityControlResponseCompany, optional)
- `companyId` (string, optional)
- `controlCheckin` (QualityControlResponseControlCheckin, optional)
- `controlChecks` (list of QualityControlResponseControlChecksItems, optional)
- `cooperationLevel` (string, optional)
- `createdAt` (datetime, optional)
- `dueDate` (datetime, optional)
- `enableQcCheckin` (boolean, optional)
- `finalResult` (enum, optional) — Quality control final result, can be any of \{ pending: 0, passed: 1, failed: 2 }
  - Allowed values: `0`, `1`, `2`
- `fixedCount` (integer, optional)
- `formVersion` (string, optional)
- `id` (string, optional)
- `inspectionDate` (datetime, optional)
- `inspectionLevel` (string, optional)
- `inspector` (QualityControlResponseInspector, optional)
- `inspectorId` (string, optional)
- `milestoneId` (string, optional)
- `milestoneName` (string, optional)
- `orderId` (string, optional)
- `orderNumber` (string, optional)
- `orderProducts` (list of QualityControlResponseOrderProductsItems, optional)
- `orderReference` (string, optional)
- `orderUuid` (string, optional)
- `orders` (list of QualityControlResponseOrdersItems, optional)
- `product` (QualityControlResponseProduct, optional)
- `productId` (string, optional)
- `productName` (string, optional)
- `qualityControlValues` (list of QualityControlResponseQualityControlValuesItems, optional)
- `quantityToControl` (integer, optional)
- `reportFileUrl` (string, optional)
- `result` (string, optional)
- `sizes` (list of string, optional)
- `status` (enum, optional) — Quality control status, can be any of \{ draft: 0, requested: 1, started: 2, completed: 3 }
  - Allowed values: `0`, `1`, `2`, `3`
- `supplier` (QualityControlResponseSupplier, optional)
- `supplierId` (integer, optional)
- `token` (string, optional)
- `userId` (string, optional)
- `uuid` (string, optional)
- `viewHistory` (map from string to any, optional)
- `willReplaceDefects` (boolean, optional)

## Errors

### 405 Method Not Allowed Error

Invalid input

- `any`

## Types

### QualityControlBase

- `milestoneId` (string, optional)
- `status` (enum, optional) — Quality control status, can be any of \{ draft: 0, requested: 1, started: 2, completed: 3 }
  - Allowed values: `0`, `1`, `2`, `3`
- `inspectorId` (string, optional)
- `acknowledgedDefectsIdentified` (boolean, optional)
- `willReplaceDefects` (boolean, optional)
- `cooperationLevel` (string, optional)
- `inspectionLevel` (string, optional)
- `approved` (boolean, optional)
- `productId` (string, optional)
- `orderNumber` (string, optional)
- `supplierId` (integer, optional)
- `fixedCount` (integer, optional)
- `inspectionDate` (datetime, optional)
- `finalResult` (enum, optional) — Quality control final result, can be any of \{ pending: 0, passed: 1, failed: 2 }
  - Allowed values: `0`, `1`, `2`
- `formVersion` (string, optional)

### QualityControlResponseCompany

- `id` (string, optional)
- `name` (string, optional)
- `logoUrl` (string, optional)

### QualityControlResponseControlCheckin

- `id` (string, optional)
- `createdAt` (datetime, optional)
- `latitude` (double, optional)
- `longitude` (double, optional)
- `inspectorPhotoUrl` (string, optional)

### QualityControlResponseControlChecksItems

- `id` (string, optional)
- `name` (string, optional)
- `names` (map from string to any, optional)
- `icon` (string, optional)
- `createdByRechain` (boolean, optional)
- `formFields` (map from string to any, optional)
- `statuses` (map from string to any, optional)
- `description` (string, optional)
- `descriptions` (map from string to any, optional)
- `position` (integer, optional)
- `qualityCheckId` (string, optional)
- `settings` (map from string to any, optional)
- `results` (map from string to any, optional)
- `status` (string, optional)
- `approval` (map from string to any, optional)
- `controlCheckPhotos` (list of QualityControlResponseControlChecksItemsControlCheckPhotosItems, optional)

### QualityControlResponseInspector

- `fullName` (string, optional)

### QualityControlResponseOrderProductsItems

- `controlVariantId` (string, optional)
- `id` (string, optional)
- `variantId` (string, optional)
- `name` (string, optional)
- `quantity` (integer, optional)
- `sizesQuantity` (map from string to any, optional)
- `quantityToControl` (integer, optional)

### QualityControlResponseOrdersItems

- `id` (string, optional)
- `exFactoryDate` (datetime, optional)
- `shippingMethod` (string, optional)
- `createdAt` (datetime, optional)
- `origin` (string, optional)

### QualityControlResponseProduct

- `id` (string, optional)
- `companyId` (string, optional)
- `name` (string, optional)
- `reference` (string, optional)
- `dimensionsUnit` (string, optional)

### QualityControlResponseQualityControlValuesItems

- `id` (string, optional)
- `content` (string, optional)
- `qualityControlFieldId` (string, optional)

### QualityControlResponseSupplier

- `id` (integer, optional)
- `name` (string, optional)
- `address` (string, optional)
- `country` (string, optional)
- `contact` (string, optional)

### QualityControlResponseControlChecksItemsControlCheckPhotosItems

- `id` (string, optional)
- `createdAt` (datetime, optional)
- `fileUrl` (string, optional)
- `comment` (string, optional)
- `rotationAngle` (double, optional)

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "acknowledgedDefectsIdentified": true,
  "actualInspectionDate": "2024-01-15T09:30:00Z",
  "approved": true,
  "company": {
    "id": "string",
    "name": "string",
    "logoUrl": "string"
  },
  "companyId": "123e4567-e89b-12d3-a456-426614174000",
  "controlCheckin": {
    "id": "string",
    "createdAt": "2024-01-15T09:30:00Z",
    "latitude": 1.1,
    "longitude": 1.1,
    "inspectorPhotoUrl": "string"
  },
  "controlChecks": [
    {
      "id": "string",
      "name": "string",
      "names": {},
      "icon": "string",
      "createdByRechain": true,
      "formFields": {},
      "statuses": {},
      "description": "string",
      "descriptions": {},
      "position": 1,
      "qualityCheckId": "string",
      "settings": {},
      "results": {},
      "status": "string",
      "approval": {},
      "controlCheckPhotos": [
        {
          "id": "string",
          "createdAt": "2024-01-15T09:30:00Z",
          "fileUrl": "string",
          "comment": "string",
          "rotationAngle": 1.1
        }
      ]
    }
  ],
  "cooperationLevel": "string",
  "createdAt": "2024-01-15T09:30:00Z",
  "dueDate": "2024-01-15T09:30:00Z",
  "enableQcCheckin": true,
  "finalResult": 1,
  "fixedCount": 0,
  "formVersion": "string",
  "id": "string",
  "inspectionDate": "2024-09-04T10:15:30Z",
  "inspectionLevel": "AQL 1.5",
  "inspector": {
    "fullName": "string"
  },
  "inspectorId": "string",
  "milestoneId": "string",
  "milestoneName": "string",
  "orderId": "string",
  "orderNumber": "4655-2027781",
  "orderProducts": [
    {
      "controlVariantId": "string",
      "id": "string",
      "variantId": "string",
      "name": "string",
      "quantity": 1,
      "sizesQuantity": {},
      "quantityToControl": 1
    }
  ],
  "orderReference": "string",
  "orderUuid": "string",
  "orders": [
    {
      "id": "string",
      "exFactoryDate": "2024-01-15T09:30:00Z",
      "shippingMethod": "string",
      "createdAt": "2024-01-15T09:30:00Z",
      "origin": "string"
    }
  ],
  "product": {
    "id": "string",
    "companyId": "string",
    "name": "string",
    "reference": "string",
    "dimensionsUnit": "string"
  },
  "productId": "123e4567-e89b-12d3-a456-426614174000",
  "productName": "string",
  "qualityControlValues": [
    {
      "id": "string",
      "content": "string",
      "qualityControlFieldId": "string"
    }
  ],
  "quantityToControl": 1,
  "reportFileUrl": "string",
  "result": "string",
  "sizes": [
    "LG"
  ],
  "status": 1,
  "supplier": {
    "id": 1,
    "name": "string",
    "address": "string",
    "country": "string",
    "contact": "string"
  },
  "supplierId": 120,
  "token": "string",
  "userId": "123e4567-e89b-12d3-a456-426614174000",
  "uuid": "string",
  "viewHistory": {},
  "willReplaceDefects": true
}
```

**SDK Code**

```python
import requests

url = "https://api.rechain.co/public/v1/quality_controls"

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.rechain.co/public/v1/quality_controls';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.rechain.co/public/v1/quality_controls"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.rechain.co/public/v1/quality_controls")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.rechain.co/public/v1/quality_controls")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.rechain.co/public/v1/quality_controls', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.rechain.co/public/v1/quality_controls");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.rechain.co/public/v1/quality_controls")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```