# Events

Manage pick-pack events

## Retrieving all events

> Retrieves all events after a specified timestamp.

```json
{"openapi":"3.0.0","info":{"title":"Pick-Pack Service","version":"0.0.1"},"tags":[{"name":"Events","description":"Manage pick-pack events"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["pickpack.pickpack_view"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"pickpack.pickpack_view":"Needed to retrieve information about resources in the service.","pickpack.pickpack_manage":"Needed to manage resources in the service."}}}}},"responses":{"eventsResponse":{"description":"Order entry event","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/OrderEntryEventResponse"}}}}},"BadRequest_400":{"description":"Request was syntactically incorrect. Details will be provided in the response payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"Unauthorized_401":{"description":"Given request is unauthorized - the authorization token is invalid or has expired. Details will be provided in the response payload.","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"Forbidden_403":{"description":"Given authorization scopes are not sufficient and do not match scopes required by the endpoint.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"code":{"type":"integer"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"string"}}}}}}},"InternalServiceError_500":{"description":"Internal Service Error occurred.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}}},"schemas":{"OrderEntryEventResponse":{"type":"object","properties":{"eventId":{"type":"string","description":"The event id"},"productId":{"type":"string","description":"The product id for which the event was created"},"deliveryCycle":{"type":"string","description":"The delivery cycle for which the event was created"},"orderNumber":{"type":"string","description":"The order number for which the event was created"},"timestamp":{"type":"string","description":"Timestamp when the event was created"},"pickedAmount":{"description":"The picked amount","type":"integer"},"packedAmount":{"description":"The packed amount","type":"integer"},"canceledAmount":{"description":"The canceled amount","type":"integer"},"packedAmountInPc":{"description":"The packed amount calculated into piece","type":"integer"},"supplierId":{"description":"The supplier id of the product for which the event was created","type":"string"},"user":{"description":"The ID of the user which has created the event","type":"string"},"site":{"description":"The site code for which the event was created","type":"string"},"unit":{"description":"The unit in which the product is packed","type":"string"},"bookProduct":{"description":"The book product flag","type":"boolean"}}},"errorMessage":{"title":"errorMessage","type":"object","properties":{"code":{"minimum":100,"maximum":599,"description":"original HTTP error code, should be consistent with the response HTTP code","type":"integer"},"message":{"pattern":"[a-z]+[a-z_]*[a-z]+","description":"classification of the error type, lower case with underscore eg validation_failure","type":"string"},"detailInfo":{"description":"More detailed information about the error","type":"string"}}}},"parameters":{"trait_tenant":{"name":"tenant","in":"path","required":true,"description":"Your Emporix tenant name.\n\n**Note**: The tenant name should always be written in lowercase.\n","schema":{"pattern":"^[a-z][a-z0-9]+$","minLength":3,"maxLength":16,"type":"string"}}}},"paths":{"/pick-pack/{tenant}/events":{"get":{"tags":["Events"],"responses":{"200":{"$ref":"#/components/responses/eventsResponse"},"400":{"$ref":"#/components/responses/BadRequest_400"},"401":{"$ref":"#/components/responses/Unauthorized_401"},"403":{"$ref":"#/components/responses/Forbidden_403"},"500":{"$ref":"#/components/responses/InternalServiceError_500"}},"description":"Retrieves all events after a specified timestamp.","parameters":[{"$ref":"#/components/parameters/trait_tenant"},{"name":"timestamp","in":"query","required":false,"schema":{"pattern":"yyyy-MM-dd'T'HH:mm:ssZ","minLength":3,"maxLength":16,"type":"string"},"description":"Date after which we want to filter the events."},{"name":"pageNumber","in":"query","required":false,"schema":{"type":"integer","minimum":0},"description":"Number of the page."},{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","minimum":0,"maximum":20000},"description":"Size of the page."}],"operationId":"GET-pick-pack-retrieve-packing-event","summary":"Retrieving all events"}}}}
```

## Creating a new packing event

> Creates a new packing event.\
> \
> \*\*Note\*\*: If the order has the \`packingStatus\` set to \`CANCELLED\`, it is not possible to create any new packing events for that order.<br>

```json
{"openapi":"3.0.0","info":{"title":"Pick-Pack Service","version":"0.0.1"},"tags":[{"name":"Events","description":"Manage pick-pack events"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["pickpack.pickpack_manage"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"pickpack.pickpack_view":"Needed to retrieve information about resources in the service.","pickpack.pickpack_manage":"Needed to manage resources in the service."}}}}},"responses":{"successResponse":{"description":"Event creation response","content":{"application/json":{"schema":{"properties":{"message":{"type":"string"},"code":{"type":"integer"}}}}}},"BadRequest_400":{"description":"Request was syntactically incorrect. Details will be provided in the response payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"Unauthorized_401":{"description":"Given request is unauthorized - the authorization token is invalid or has expired. Details will be provided in the response payload.","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"Forbidden_403":{"description":"Given authorization scopes are not sufficient and do not match scopes required by the endpoint.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"code":{"type":"integer"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"string"}}}}}}},"Conflict_409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"InternalServiceError_500":{"description":"Internal Service Error occurred.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}}},"schemas":{"errorMessage":{"title":"errorMessage","type":"object","properties":{"code":{"minimum":100,"maximum":599,"description":"original HTTP error code, should be consistent with the response HTTP code","type":"integer"},"message":{"pattern":"[a-z]+[a-z_]*[a-z]+","description":"classification of the error type, lower case with underscore eg validation_failure","type":"string"},"detailInfo":{"description":"More detailed information about the error","type":"string"}}},"OrderEntryEventCreate":{"type":"object","properties":{"eventId":{"type":"string","description":"The event id generated by the client"},"orderNumber":{"type":"string","description":"The order number for which the packing event is created"},"productId":{"type":"string","description":"The product id for which the packing event is created"},"deliveryCycle":{"type":"string","description":"The delivery cycle for which the packing event is created"},"pickedAmount":{"type":"integer","description":"The amount of picked items"},"packedAmount":{"type":"integer","description":"The amount of packed items"},"canceledAmount":{"type":"integer","description":"The amount of cancelled items"},"supplierId":{"type":"string","description":"The supplier id"},"unit":{"type":"string","description":"The unit of the packed item"},"timestamp":{"type":"string","format":"date-time","description":"Timestamp of the packing event in ISO format"},"site":{"type":"string","description":"The site code for which the event is created"},"bookProduct":{"type":"boolean"}},"required":["eventId","orderNumber","productId","unit","timestamp","site"]}},"parameters":{"trait_tenant":{"name":"tenant","in":"path","required":true,"description":"Your Emporix tenant name.\n\n**Note**: The tenant name should always be written in lowercase.\n","schema":{"pattern":"^[a-z][a-z0-9]+$","minLength":3,"maxLength":16,"type":"string"}},"trait_saas_token":{"name":"saas-token","in":"header","required":true,"description":"Token provided by the Emporix system, used to identify logged in customers. This token has an expiry date and is signed with a passphrase.\n","schema":{"type":"string"}}}},"paths":{"/pick-pack/{tenant}/events":{"post":{"tags":["Events"],"responses":{"200":{"$ref":"#/components/responses/successResponse"},"400":{"$ref":"#/components/responses/BadRequest_400"},"401":{"$ref":"#/components/responses/Unauthorized_401"},"403":{"$ref":"#/components/responses/Forbidden_403"},"409":{"$ref":"#/components/responses/Conflict_409"},"500":{"$ref":"#/components/responses/InternalServiceError_500"}},"description":"Creates a new packing event.\n\n**Note**: If the order has the `packingStatus` set to `CANCELLED`, it is not possible to create any new packing events for that order.\n","parameters":[{"$ref":"#/components/parameters/trait_tenant"},{"$ref":"#/components/parameters/trait_saas_token"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderEntryEventCreate"}}}},"operationId":"POST-pick-pack-create-packing-event","summary":"Creating a new packing event"}}}}
```


---

# 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://developer.emporix.io/api-references/api-guides/orders/pick-pack/api-reference/events.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.
