# Integration Stats

## Create Stats

<mark style="color:green;">`POST`</mark> `https://api.woowup.com/apiv3/integration-stats`

Create stats in WoowUp based on your processing stats. This includes files stats (eg. read lines, valid lines, invalid lines) and API Stats (e.g created/updated/failed customers). Below is the JSON-schema definition for each body parameter.

#### Request Body

| Name         | Type   | Description                                                                |
| ------------ | ------ | -------------------------------------------------------------------------- |
| customers    | object | Customers API stats: created, updated, failed.                             |
| products     | object | Products API stats: created, updated, failed.                              |
| branches     | object | Branches API stats: created, updated, failed.                              |
| purchases    | object | Purchases API stats: created, updated, duplicated, failed, revenue, units. |
| files\_stats | array  | Files stats (array of objects, one object per file)                        |

{% tabs %}
{% tab title="201 Stats successfully created" %}

```javascript
```

{% endtab %}

{% tab title="400 " %}

```
```

{% endtab %}

{% tab title="500 " %}

```
```

{% endtab %}
{% endtabs %}

#### JSON schema

```javascript
{  
	"$schema":"http:\/\/json-schema.org\/draft-04\/schema#",
	"description":"A representation of a integrations stats",
	"type":"object",
	"properties":{  
	   "customers":{  
	      "type":"object",
	      "properties":{  
	         "created":{"type":"integer"},
	         "updated":{"type":"integer"},
	         "failed":{  
	            "type":"array",
	            "items":{  
	               "type":"object",
	               "required":["element"],
	               "properties":{  
	                  "element":{"type":"object"},
	                  "message":{"type":"string"}
	               }
	            }
	         }
	      }
	   },
	   "products":{  
	      "type":"object",
	      "properties":{  
	         "created":{"type":"integer"},
	         "updated":{"type":"integer"},
	            "failed":{  
	            "type":"array",
	            "items":{  
	               "type":"object",
	               "required":["element"],
	               "properties":{  
	                  "element":{"type":"object"},
	                  "message":{"type":"string"}
	               }
	            }
	         }
	      }
	   },
	   "branches":{  
	      "type":"object",
	      "properties":{  
	         "created":{"type":"integer"},
	         "updated":{"type":"integer"},
	         "failed":{  
	            "type":"array",
	            "items":{  
	               "type":"object",
	               "required":["element"],
	               "properties":{  
	                  "element":{"type":"object"},
	                  "message":{"type":"string"}
	               }
	            }
	         }
	       }
	   },
	   "purchases":{  
	      "type":"object",
	      "properties":{  
	         "created":{"type":"integer"},
	         "updated":{"type":"integer"},
	         "duplicated":{"type":"integer"},
	         "revenue":{"type":"number"},
	         "units":{"type":"integer"},
	         "failed":{  
	            "type":"array",
	            "items":{  
	               "type":"object",
	               "required":["element"],
	               "properties":{  
	                  "element":{"type":"object"},
	                  "message":{"type":"string"}
	               }
	            }
	         }
	      }
	   },
	   "createtime":{"type":"string"},
	   "files_stats":{  
	      "type":"array",
	      "items":{  
	         "type":"object",
	         "required":["filename"],
	         "properties":{  
	            "filename":{"type":"string"},
	            "read_lines":{"type":"integer"},
	            "valid_lines":{"type":"integer"},
	            "unique_registers":{"type":"integer"},
	            "invalid_lines":{
	               "type":"array",
	               "items":{  
	                  "type":"object",
	                  "required":["line"],
	                  "properties":{  
	                     "line":{"type":"integer"},
	                     "message":{"type":"string"},
	                     "additional_details":{"type":"object"}
	                  }
	               }
	            },
	            "revenue":{"type":"number"},
	            "units":{"type":"integer"},
	            "orders_customers":{"type":"integer"}
	         }
	      }
	   }
	}
}
```

## List stats

<mark style="color:blue;">`GET`</mark> `https://api.woowup.com/apiv3/integration-stats`

Retrieve your sync stats

#### Query Parameters

| Name  | Type   | Description                          |
| ----- | ------ | ------------------------------------ |
| from  | string | Date from. Format yyyy-mm-dd         |
| to    | string | Date to. Format yyyy-mm-dd           |
| page  | string | <p>Current page. Starts at 0<br></p> |
| limit | string | Items per page. Limit 100            |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}

{% tab title="400 " %}

```
```

{% endtab %}

{% tab title="500 " %}

```
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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://woowup-docs.gitbook.io/woowup-developer-docs/api/integration-stats.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.
