How to map Internal Order ID to Public Order Number via API?

To the Technical Support Team,

We are currently experiencing a discrepancy between the Order IDs stored in our backend and the IDs presented to the end-users.

The Scenario:

  • System/Internal ID: We receive a long numeric string (e.g., 6869841936662).

  • Customer/Public ID: The customer sees a formatted string (e.g., #KD23316).

We need to map these two values programmatically. Is there an API method available that allows us to query the system using the Internal ID to get the corresponding Public Order Number?

Thank you for your assistance.

You can use order query to get name by id.

  • Name: Customer/Public ID
  • ID: System/Internal ID

Please note:
The format of ID is gid://shopify/Order/${Internal_ID}
For example: gid://shopify/Order/6869841936662