Thanks to the answer, I have added the json-bigint to transform the response in my axios request.
export function getTikTokPublishStatus(id: string, tkn: string) {
return axios
.post(
https://open.tiktokapis.com/v2/post/publish/status/fetch/
,
{
publish_id: id,
},
{
headers: {Authorization: Bearer ${tkn}
},
transformResponse: [
(data) => {
// Parse response with json-bigint to handle large numbers correctly
const jsonData = JSONbig.parse(data);
return jsonData;
},
],
}
)
.then((resp) => {
const {data} = resp;
// Convert BigInt to string to preserve full number precision
const publicId = data.data.publicaly_available_post_id?.[0]?.toString();
return publicId
});
}