## Sync to Default Pricing

### cURL

```bash
curl --request POST \
  --url https://app.barndoor.ai/api/llm-gateway/admin/model-pricing/sync-defaults \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "ids": [\
    "3c90c3cc-0d44-4b50-8888-8dd25736052a"\
  ]
}'
```

### Python

```python
import requests

url = "https://app.barndoor.ai/api/llm-gateway/admin/model-pricing/sync-defaults"

payload = { "ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"] }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.text)
```

### JavaScript (Fetch API)

```javascript
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a']})
};

fetch('https://app.barndoor.ai/api/llm-gateway/admin/model-pricing/sync-defaults', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### PHP

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, [\
  CURLOPT_URL => "https://app.barndoor.ai/api/llm-gateway/admin/model-pricing/sync-defaults",\
  CURLOPT_RETURNTRANSFER => true,\
  CURLOPT_ENCODING => "",\
  CURLOPT_MAXREDIRS => 10,\
  CURLOPT_TIMEOUT => 30,\
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\
  CURLOPT_CUSTOMREQUEST => "POST",\
  CURLOPT_POSTFIELDS => json_encode([\
    'ids' => [\
        '3c90c3cc-0d44-4b50-8888-8dd25736052a'\
    ]\
  ]),\
  CURLOPT_HTTPHEADER => [\
    "Authorization: Bearer <token>",\
    "Content-Type: application/json"\
  ],\
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
```

### Go

```go
package main

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

func main() {

url := "https://app.barndoor.ai/api/llm-gateway/admin/model-pricing/sync-defaults"

payload := strings.NewReader("{\n  \"ids\": [\n    \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"]\n}")

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(string(body))
}
```

### Response Example

```json
{
  "synced": 123
}
```

### Authorization

Authorization is a required string header:
- JWT obtained through Barndoor's authentication flow. Pass the token as `Authorization: Bearer <token>`.

### Body

- `ids` is an array of strings (UUIDs): A subset of org rule IDs to sync. An empty or omitted array syncs all stale rows.

### Response

- **200** - application/json: Returns the number of rows synced.

- `synced` is an integer.
