How Can We Help?

Document Verification (Crop) Api via Postman or C#

Postman Example

This describes the process of calling the Document Verification Crop endpoint using Postman

Postman is a free app that allows you to perform HTTP requests. You can download it from the Postman website here.

Option 1 – Download and import our example collection

We have set up an example Postman collection that contains example requests that you can import https://github.com/W2-Global-Data/Api-Samples/tree/main/REST

All you will need to do is insert your W2 provided API key into the Authorization header of any request in the collection and it should work

Option 2 – Setup your own

1) Set the request method to Post

2) Set the URL to the verify endpoint: https://api.w2globaldata.com/document-verification/crop?api-version=1.1

3) Add an Authentication header to the request with the schema Basic and the value set to your Api Key.

4) Set the body of the request to ‘form-data’

5) Add the request values to the body. Full request details here

6) Send the request and view the response.

C# Example

An example of how to call the document verification crop endpoint using C#

C#
    using System;
    using System.IO;
    using System.Net.Http;
    using System.Threading.Tasks;
    using Newtonsoft.Json;

    public class Program
    {
        public class CropResult
        {
            public string Image { get; set; }
        }

        static async Task Main(string[] args)
        {
            var client = new HttpClient();

            var content = new MultipartFormDataContent();

            content.Add(new ByteArrayContent(File.ReadAllBytes("/ID1-Page1.png")), "Image", "image.png");

            content.Add(new StringContent("Id1"), "DocumentType");

            content.Add(new StringContent("1"), "Page");

            var response = await client.SendAsync(new HttpRequestMessage
            {
                Method = HttpMethod.Post,
                Headers = { { "Authorization", "Basic YourApiKey" } },
                RequestUri = new Uri("https://api.w2globaldata.com/document-verification/crop?api=version=1.1"),
                Content = content
            });

            var cropResult = JsonConvert.DeserializeObject<CropResult>(
                await response.Content.ReadAsStringAsync());

            File.WriteAllBytes("id1-cropped.png", Convert.FromBase64String(cropResult.Image));

            Console.WriteLine("Cropped image saved");

            Console.ReadLine();
        }
    }
Scroll to Top