Updated on April 30, 2024

Get status of Async method

The asynchronous status method enables us to monitor the status of both masking and unmasking processes.

This approach enables you to track the status of the asynchronous request you’ve submitted. The possible statuses include “SUCCESS”,”PENDING”,”IN-PROGRESS”,”FAILED” and “PURGED” .If the request attains a “SUCCESS” status, the outcome will encompass the mask/unmask response. Any successful mask/unmask requests undergo automatic purging after one hour.

Note: To obtain the <auth token>, please refer to the Step-by-Step Guide to Obtain Your Auth Token.

Code Snippet

# pass the tracking id as a list to the async method
payload = ["d1b6fa4f-c92e-480a-9f1f-f62f2743f53229042024082153","b6b7ef0e-86f6-4490-b0f8-4962a43656f929042024083721"]
status = obj.async_status(payload)
print(status)

Result structure for status “SUCCESS”:

{
  "data": [
    {
      "tracking_id": "b6b7ef0e-86f6-4490-b0f8-4962a43656f929042024083721",
      "call_type": "unmask",
      "input_payload": {
        "unmask": [
          {
            "token_value": "n3dVs6D0Ni"
          },
          {
            "token_value": "<PER>n3dVs6D0Ni</PER>"
          },
          {
            "token_value": "<PER>n3dVs6D0Ni</PER> lives in the <ADDRESS>8SNwyGwcY2.YcLTWWIXHF.iLgmVciGq1</ADDRESS>"
          }
        ]
      },
      "result": [
        {
          "token_value": "n3dVs6D0Ni",
          "value": "Washington"
        },
        {
          "token_value": "<PER>n3dVs6D0Ni</PER>",
          "value": "Washington"
        },
        {
          "token_value": "<PER>n3dVs6D0Ni</PER> lives in the <ADDRESS>8SNwyGwcY2.YcLTWWIXHF.iLgmVciGq1</ADDRESS>",
          "value": "Washington lives in the U.S.A"
        }
      ],
      "error_msg": null,
      "submitted_time": "2024-04-29 08:37:21",
      "completed_time": "2024-04-29 08:37:23",
      "status": "SUCCESS"
    },
    {
      "tracking_id": "9f799cb6-5315-4199-8d47-3a7ced21dd1d29042024113301",
      "call_type": "mask",
      "input_payload": {
        "mask": [
          {
            "value": "He lives in the U.S.A"
          },
          {
            "value": "George Washington visited China."
          }
        ]
      },
      "result": [
        {
          "individual_tokens": [
            {
              "end_pos": 21,
              "pii_type": "GPE",
              "prefix": "<ADDRESS>",
              "start_pos": 16,
              "suffix": "</ADDRESS>",
              "token": "8SNwyGwcY2.YcLTWWIXHF.iLgmVciGq1",
              "value": "U.S.A"
            }
          ],
          "token_value": "He lives in the <ADDRESS>8SNwyGwcY2.YcLTWWIXHF.iLgmVciGq1</ADDRESS>",
          "toxicity_analysis": {
            "identity_attack": 0.00016385513,
            "insult": 0.0001878653,
            "obscene": 0.00022433957,
            "severe_toxicity": 0.000108136555,
            "threat": 0.00010206094,
            "toxicity": 0.0011858705
          },
          "value": "He lives in the U.S.A"
        },
        {
          "individual_tokens": [
            {
              "end_pos": 17,
              "pii_type": "PERSON",
              "prefix": "<PER>",
              "start_pos": 0,
              "suffix": "</PER>",
              "token": "jVQwQg7Lre n3dVs6D0Ni",
              "value": "George Washington"
            },
            {
              "end_pos": 31,
              "pii_type": "GPE",
              "prefix": "<ADDRESS>",
              "start_pos": 26,
              "suffix": "</ADDRESS>",
              "token": "2tklzMplO6",
              "value": "China"
            }
          ],
          "token_value": "<PER>jVQwQg7Lre n3dVs6D0Ni</PER> visited <ADDRESS>2tklzMplO6</ADDRESS>.",
          "toxicity_analysis": {
            "identity_attack": 0.00015060016,
            "insult": 0.00017572763,
            "obscene": 0.00018311219,
            "severe_toxicity": 0.00012111001,
            "threat": 0.00011789548,
            "toxicity": 0.00069625187
          },
          "value": "George Washington visited China."
        }
      ],
      "error_msg": null,
      "submitted_time": "2024-04-29 08:21:53",
      "completed_time": "2024-04-29 08:22:05",
      "status": "SUCCESS"
    }
  ],
  "success": true,
  "error": {
    "message": ""
  }
}

Result structure for status “IN-PROGRESS”:

If the status is IN_PROGRESS, try again after a few minutes to see if the data has been processed.

{
  "data": [
    {
      "tracking_id": "b6b7ef0e-86f6-4490-b0f8-4962a43656f929042024083721",
      "call_type": "unmask",
      "input_payload": {
        "unmask": [
          {
            "token_value": "n3dVs6D0Ni"
          },
          {
            "token_value": "<PER>n3dVs6D0Ni</PER>"
          },
          {
            "token_value": "<PER>n3dVs6D0Ni</PER> lives in the <ADDRESS>8SNwyGwcY2.YcLTWWIXHF.iLgmVciGq1</ADDRESS>"
          }
        ]
      },
      "result":"None",
      "error_msg":"None",
      "submitted_time": "2024-04-29 08:37:21",
      "completed_time":"None",
      "status":"IN-PROGRESS"
    },
    {
      "tracking_id": "d1b6fa4f-c92e-480a-9f1f-f62f2743f53229042024082153",
      "call_type": "mask",
      "input_payload": {
        "mask": [
          {
            "value": "He lives in the U.S.A"
          },
          {
            "value": "George Washington visited China."
          }
        ]
      },
      "result":"None",
      "error_msg":"None",
      "submitted_time": "2024-04-29 08:21:53",
      "completed_time":"None",
      "status":"IN-PROGRESS"
    }
  ],
  "success": true,
  "error": {
    "message": ""
  }
}

Result structure for status “PENDING”:

{
  "data": [
    {
      "tracking_id": "b6b7ef0e-86f6-4490-b0f8-4962a43656f929042024083721",
      "call_type": "unmask",
      "input_payload": {
        "unmask": [
          {
            "token_value": "n3dVs6D0Ni"
          },
          {
            "token_value": "<PER>n3dVs6D0Ni</PER>"
          },
          {
            "token_value": "<PER>n3dVs6D0Ni</PER> lives in the <ADDRESS>8SNwyGwcY2.YcLTWWIXHF.iLgmVciGq1</ADDRESS>"
          }
        ]
      },
      "result":"None",
      "error_msg":"None",
      "submitted_time": "2024-04-29 08:37:21",
      "completed_time":"None",
      "status":"PENDING"
    },
    {
      "tracking_id": "d1b6fa4f-c92e-480a-9f1f-f62f2743f53229042024082153",
      "call_type": "mask",
      "input_payload": {
        "mask": [
          {
            "value": "He lives in the U.S.A"
          },
          {
            "value": "George Washington visited China."
          }
        ]
      },
      "result":"None",
      "error_msg":"None",
      "submitted_time": "2024-04-29 08:21:53",
      "completed_time":"None",
      "status":"PENDING"
    }
  ],
  "success": true,
  "error": {
    "message": ""
  }
}

Result structure for status “FAILED”:

 { "data": [
    {
      "tracking_id": "43318680-9515-432c-a152-1b9b9ebc1ba629042024114022",
      "call_type": "unmask",
      "input_payload": {
        "unmask": []
      },
      "result": null,
      "error_msg": "Processing Async request failed for tracker_id:43318680-9515-432c-a152-1b9b9ebc1ba629042024114022 with error: Payload is empty",
      "submitted_time": "2024-04-29 11:40:22",
      "completed_time": "2024-04-29 11:40:23",
      "status": "FAILED"
    },
    {
      "tracking_id": "aff361c8-50da-4680-9b07-9d1c1b1b004229042024113917",
      "call_type": "mask",
      "input_payload": {
        "mask": [
          {
            "": "He lives in the U.S.A"
          },
          {
            "value": "George Washington visited China."
          }
        ]
      },
      "result": null,
      "error_msg": "Processing Async request failed for tracker_id:aff361c8-50da-4680-9b07-9d1c1b1b004229042024113917 with error: Missing value",
      "submitted_time": "2024-04-29 11:39:17",
      "completed_time": "2024-04-29 11:39:23",
      "status": "FAILED"
    }
  ],
  "success": true,
  "error": {
    "message": ""
  }
}

Result structure for status “PURGED”:

{
  "data": [
    {
      "tracking_id": "b6b7ef0e-86f6-4490-b0f8-4962a43656f929042024083721",
      "call_type": "unmask",
      "input_payload":"None",
      "result":"None",
      "error_msg":"None",
      "submitted_time": "2024-04-29 08:37:21",
      "completed_time": "2024-04-29 08:37:23",
      "status": "PURGED"
    },
    {
      "tracking_id": "d1b6fa4f-c92e-480a-9f1f-f62f2743f53229042024082153",
      "call_type": "mask",
      "input_payload":"None",
      "result":"None",
      "error_msg":"None",
      "submitted_time": "2024-04-29 08:21:53",
      "completed_time": "2024-04-29 08:22:05",
      "status": "PURGED"
    }
  ],
  "success": true,
  "error": {
    "message": ""
  }
}

For more comprehensive information about our product, kindly reach out to us through our website at https://www.protecto.ai/.

What are your feelings
Scroll to Top