# Search

Details of how the `v2/search` endpoint can be used to retrieve a list of the most recently created trackings in the parcelLab system are described below.

## Search recent trackings

> Retrieves recent trackings from the parcelLab system. The response gives some meta information and then a list of all recently created trackings, sorted descending via the timestamp of creation (can be found in results\[].cre.dat)

```json
{"openapi":"3.0.3","info":{"title":"v2 search","version":"1.0.0"},"servers":[{"url":"https://api.parcellab.com","description":"Production"}],"security":[{"Authorization":[]}],"components":{"securitySchemes":{"Authorization":{"type":"apiKey","in":"header","name":"Authorization","description":"Use the format `Parcellab-API-Token <your-base64-encoded-api-key>`"}},"schemas":{"SearchRequest":{"type":"object","properties":{"s":{"type":"string","description":"Any search term or reference number"},"p":{"type":"integer","description":"What page to show (pagination). Defaults to 0."},"pSize":{"type":"integer","description":"Number of entries on a page. Defaults to 24."},"from":{"type":"string","description":"The date range to filter by in YYYY-MM-DD format. Defaults to last 7 days."},"country":{"type":"string","description":"Comma-separated list of destination_country_iso3 codes in ISO 3166-1 alpha-3 or alpha-2 format to filter by."},"courier":{"type":"string","description":"Comma-separated list of courier codes to filter by."},"client":{"type":"string","description":"Comma-separated list of client codes as provided on tracking."},"return":{"type":"boolean","description":"If true, only return trackings are shown. If false, only outbound trackings are shown. If empty, then both are shown."},"branchDelivery":{"type":"boolean","description":"If true, only branch deliveries are shown. If empty, then all are shown."}}},"AcceptResponse":{"description":"Results for searched trackings","type":"object","properties":{"id":{"type":"string","description":"Tracking ID (unique tracking identifier)"},"tn":{"type":"string","description":"Tracking number"},"co":{"type":"object","description":"Carrier information","items":null,"$ref":"#/components/schemas/Courier"},"cre":{"type":"object","description":"Creation timestamps","$ref":"#/components/schemas/Creation"},"lst":{"type":"object","description":"Last status information","$ref":"#/components/schemas/LastStatus"},"inf":{"type":"object","description":"Delivery information (primary)","$ref":"#/components/schemas/DeliveryInfo"},"oth":{"type":"object","description":"Additional delivery information (flags and specific delivery circumstances)","$ref":"#/components/schemas/DeliveryInfoOther"},"rep":{"type":"object","description":"Reporting information, if available.","$ref":"#/components/schemas/Reporting"},"tr":{"type":"object","description":"Information on transport trackings (pseudo-trackings for orders with multiple items)","$ref":"#/components/schemas/Transport"},"bil":{"type":"object","description":"Billing contact information","$ref":"#/components/schemas/Billing"},"mtp":{"type":"object","description":"Marketplace information, if applicable.","$ref":"#/components/schemas/Marketplace"},"act":{"type":"object","description":"Activity monitor information, if available.","$ref":"#/components/schemas/ActivityMonitor"}}},"Courier":{"type":"object","properties":{"n":{"type":"string","description":"Carrier code"},"p":{"type":"string","description":"Carrier name"},"pri":{"type":"string","description":"Carrier's primary color"},"sec":{"type":"string","description":"Carrier's secondary color"},"url":{"type":"string","description":"Image URL for carrier's logo. Defaults to https://cdn.parcellab.com/img/couriers_logo/other.svg."}}},"Creation":{"type":"object","properties":{"dat":{"type":"string","format":"date-time","description":"Timestamp for when the tracking was created"},"ago":{"type":"string","description":"Localized calaculation of the number of days since the tracking was created"}}},"LastStatus":{"type":"object","properties":{"dat":{"type":"string","format":"date-time","description":"Timestamp of the latest event"},"ago":{"type":"string","description":"Localized calaculation of the number of days since the `dat` timestamp"},"sta":{"type":"object","description":"Details on the current status","properties":{"code":{"type":"string","description":"Status code"},"status":{"type":"string","description":"Status name"},"status_details":{"type":"string","description":"Status description"},"timestamp":{"type":"string","description":"Timestamp for the current status"},"iconHint":{"type":"string","description":"Status icon"},"step":{"type":"integer"},"lifecycle":{"type":"string"},"flag_failedAttempt":{"type":"boolean","description":"Indicates if there was a failed delivery attempt."},"flag_delayedDispatch":{"type":"boolean","description":"Indicates if dispatch was delayed."},"flag_delayed":{"type":"boolean","description":"Indicates if delivery is delayed."}}}}},"DeliveryInfo":{"type":"object","properties":{"rcp":{"type":"string","description":"Recipient's full name"},"rcn":{"type":"string","description":"Recipient's first name"},"eml":{"type":"string","format":"email","description":"Recipient's email address"},"pho":{"type":"string","description":"Recipient's phone number"},"str":{"type":"string","description":"Street name"},"zip":{"type":"string","description":"Zip code or postal code"},"cty":{"type":"string","description":"City"},"ctry":{"type":"object","description":"Country","properties":{"n":{"type":"string","description":"Destination country code in ISO format"},"p":{"type":"string","description":"Destination country"}}},"orn":{"type":"string","description":"Order number"},"dln":{"type":"string","description":"Delivery number"},"cun":{"type":"string","description":"Customer number"},"trn":{"type":"string","description":"Transport number"},"con":{"type":"string","description":"Consignment number"},"odt":{"type":"string","description":"Order date"},"lstrfrsh":{"type":"string","format":"date-time","description":"Last refresh timestamp"},"lastupdt":{"type":"string","format":"date-time","description":"Timestamp for last tracking update"},"imprtsrc":{"type":"object","description":"Metadata about the import source"},"srvc":{"type":"string","description":"Tracking service used"},"pod":{"type":"boolean","description":"Indicates if tracking has proof of delivery"},"clmd":{"type":"boolean","description":"Indicates if the tracking has been marked as claimed"},"art":{"type":"array","description":"Array of article objects","properties":{"nam":{"type":"string","description":"Article name"},"sku":{"type":"string","description":"Article SKU"},"img":{"type":"string","description":"Article image URL"},"qty":{"type":"integer","description":"Article quantity"}}}}},"DeliveryInfoOther":{"type":"object","properties":{"ret":{"type":"boolean","description":"Indicates if the tracking is a return tracking"},"retpo":{"type":"boolean","description":"Indicates if the tracking was created via the Returns Portal"},"retpopr":{"type":"boolean","description":"Indicates if `isAdditionalLabel` is not true"},"brnch":{"type":"boolean","description":"Indicates if the delivery is a branch delivery"},"cxl":{"type":"boolean","description":"Indicates if the delivery is cancelled"},"cli":{"type":"string","description":"The brand or shop's name"}}},"Reporting":{"type":"object","properties":{"dly":{"type":"boolean","description":"Delayed status"},"esc":{"type":"boolean","description":"Escalated status"},"ret":{"type":"boolean","description":"Returned status"},"frg":{"type":"boolean","description":"Forgotten status"},"inv":{"type":"boolean","description":"Invalid status"},"cnt":{"type":"boolean","description":"Indicates if communication was sent"},"bnc":{"type":"boolean","description":"Indicates if communication was sent and bounced"},"tlp":{"type":"boolean","description":"Trending late probability, populated only if not null."},"trendingLateStatus":{"type":"boolean","description":"Trending late status, populated only if `tlp` is not null."}}},"Transport":{"type":"object","required":["is"],"properties":{"is":{"type":"boolean","description":"Indicates whether the tracking is a transport tracking"},"n":{"type":"string","description":"Transport carrier code"},"p":{"type":"string","description":"Transport carrier name"},"tn":{"type":"string","description":"Transport tracking number"},"pri":{"type":"string","description":"Primary color of the transport carrier"},"sec":{"type":"string","description":"Secondary color of the transport carrier"}},"oneOf":[{"required":["is"],"properties":{"is":{"type":"boolean","enum":[false]}}},{"required":["is","n","p","tn","pri","sec"],"properties":{"is":{"type":"boolean","enum":[true]}}}]},"Billing":{"type":"object","properties":{"rcp":{"type":"string","description":"Customer's name"},"pho":{"type":"string","description":"Phone number"},"eml":{"type":"string","format":"email","description":"Email address"},"str":{"type":"string","description":"Street name"},"cty":{"type":"string","description":"City"},"zip":{"type":"string","description":"Zip code or postal code"},"reg":{"type":"string","description":"Region"},"ctr":{"type":"string","description":"Country"}}},"Marketplace":{"type":"object","properties":{"drp":{"type":"boolean","description":"Dropshipment status"},"nam":{"type":"string","description":"Marketplace name"}}},"ActivityMonitor":{"type":"object","properties":{"stg":{"type":"string","description":"Current stage in delivery lifecycle"}}},"ErrorResponse":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/v2/search":{"get":{"summary":"Search recent trackings","description":"Retrieves recent trackings from the parcelLab system. The response gives some meta information and then a list of all recently created trackings, sorted descending via the timestamp of creation (can be found in results[].cre.dat)","parameters":[{"in":"header","name":"Content-Type","required":true,"schema":{"type":"string","enum":["application/json"]},"description":"Must be application/json"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchRequest"}}}},"responses":{"200":{"description":"Request successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptResponse"}}}},"401":{"description":"Unauthorized request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

### Checking Last Transfer via API

If you want to programmatically monitor the success of any data transmission, you can do so by calling the latest submitted records and checking the timestamp. For all details of this request, see the information below, which shows a useful API call to check the most recent data transmission.

```bash
curl -L \
  --url 'https://api.parcellab.com/v2/search' \
  --header 'Authorization: Parcellab-API-Token <your-API-token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "pSize": 1
  }'
```

This returns exactly on result, hence the timestamp of the most recent successful data transmission can be found at `response.results[0].cre.dat` and has the format `YYYY-MM-DDTHH:mm:ss.sssZ`.


---

# 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://docs.parcellab.com/docs/developers/v2/orders/search.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.
