> For the complete documentation index, see [llms.txt](https://docs.pearprotocol.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pearprotocol.io/api-integration/api-specification/sync.md).

# Sync

## POST /sync/fills

> Sync external fills into internal state

```json
{"openapi":"3.0.0","info":{"title":"Pear Protocol Trading API","version":"1.0.0"},"servers":[{"url":"https://hl-v2.pearprotocol.io","description":"Production (Mainnet)"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}},"schemas":{"SyncFillsRequestDto":{"type":"object","properties":{"user":{"type":"string","description":"User EVM address"},"fills":{"description":"External fills to sync","type":"array","items":{"$ref":"#/components/schemas/ExternalFillDto"}},"assetPositions":{"description":"Current asset positions from clearinghouse state","type":"array","items":{"type":"string"}}},"required":["user","fills"]},"ExternalFillDto":{"type":"object","properties":{"coin":{"type":"string","description":"Asset symbol"},"px":{"type":"string","description":"Fill price"},"sz":{"type":"string","description":"Fill size"},"side":{"type":"string","description":"Side","enum":["B","A"]},"time":{"type":"number","description":"Timestamp in ms"},"dir":{"type":"string","description":"Direction (e.g. Open Long, Close Short)"},"fee":{"type":"string","description":"Fee amount"},"builderFee":{"type":"string","description":"Builder fee"},"startPosition":{"type":"string","description":"Start position size"},"oid":{"type":"string","description":"Order ID"},"tid":{"type":"string","description":"Trade ID"},"cloid":{"type":"string","description":"Client order ID","nullable":true},"hash":{"type":"string","description":"Transaction hash","nullable":true},"feeToken":{"type":"string","description":"Fee token","nullable":true},"liquidation":{"description":"Liquidation details","nullable":true,"allOf":[{"$ref":"#/components/schemas/ExternalLiquidationDto"}]},"closedPnl":{"type":"object","description":"Closed PnL","nullable":true},"crossed":{"type":"object","description":"Whether fill crossed the spread","nullable":true},"twapId":{"type":"object","description":"TWAP order ID","nullable":true}},"required":["coin","px","sz","side","time","dir","fee"]},"ExternalLiquidationDto":{"type":"object","properties":{"liquidatedUser":{"type":"string","description":"Liquidated user address"},"markPx":{"type":"string","description":"Mark price at liquidation"},"method":{"type":"string","description":"Liquidation method"}},"required":["liquidatedUser","markPx","method"]}}},"paths":{"/sync/fills":{"post":{"operationId":"SyncController_syncFills","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SyncFillsRequestDto"}}}},"responses":{"200":{"description":"Sync completed"}},"summary":"Sync external fills into internal state","tags":["Sync"]}}}}
```


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pearprotocol.io/api-integration/api-specification/sync.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
