Process documents by using the console

This quickstart introduces you to Document AI. In this quickstart, you will use the Google Cloud console to set up your Google Cloud project and authorization, create a form parser, and then make a request for Document AI to process a form PDF document.

Before you begin

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Cloud project. Learn how to check if billing is enabled on a project.

  4. Enable the Cloud Document AI API.

    Enable the API

  5. Create a service account:

    1. In the console, go to the Create service account page.

      Go to Create service account
    2. Select your project.
    3. In the Service account name field, enter a name. The console fills in the Service account ID field based on this name.

      In the Service account description field, enter a description. For example, Service account for quickstart.

    4. Click Create and continue.
    5. To provide access to your project, grant the following role(s) to your service account: Document AI > Document AI Administrator .

      In the Select a role list, select a role.

      For additional roles, click Add another role and add each additional role.

    6. Click Continue.
    7. Click Done to finish creating the service account.

      Do not close your browser window. You will use it in the next step.

  6. Create a service account key:

    1. In the console, click the email address for the service account that you created.
    2. Click Keys.
    3. Click Add key, and then click Create new key.
    4. Click Create. A JSON key file is downloaded to your computer.
    5. Click Close.
  7. Set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the path of the JSON file that contains your service account key. This variable only applies to your current shell session, so if you open a new session, set the variable again.

  8. Install and initialize the Google Cloud CLI.
  9. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  10. Make sure that billing is enabled for your Cloud project. Learn how to check if billing is enabled on a project.

  11. Enable the Cloud Document AI API.

    Enable the API

  12. Create a service account:

    1. In the console, go to the Create service account page.

      Go to Create service account
    2. Select your project.
    3. In the Service account name field, enter a name. The console fills in the Service account ID field based on this name.

      In the Service account description field, enter a description. For example, Service account for quickstart.

    4. Click Create and continue.
    5. To provide access to your project, grant the following role(s) to your service account: Document AI > Document AI Administrator .

      In the Select a role list, select a role.

      For additional roles, click Add another role and add each additional role.

    6. Click Continue.
    7. Click Done to finish creating the service account.

      Do not close your browser window. You will use it in the next step.

  13. Create a service account key:

    1. In the console, click the email address for the service account that you created.
    2. Click Keys.
    3. Click Add key, and then click Create new key.
    4. Click Create. A JSON key file is downloaded to your computer.
    5. Click Close.
  14. Set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the path of the JSON file that contains your service account key. This variable only applies to your current shell session, so if you open a new session, set the variable again.

  15. Install and initialize the Google Cloud CLI.

Create a form parser

Use the Google Cloud console to create a new form parser:

  1. Open the Document AI dashboard.

    Go to the Document AI dashboard

  2. Click Create processor.

  3. In the Create processor page, select the Form parser option.

    Form parser option in UI

  4. In the side window, name your processor quickstart-form-processor and choose your region.

  5. Click Create. You will be taken to the details page of your newly created form processor.

Send the request to the form parser

After creating your processor you can send annotation requests to it.

  1. Save a local copy of the sample form document (gs://cloud-samples-data/documentai/loan_form.pdf). This document is stored in a publicly accessible Cloud Storage bucket.

  2. In the Test your processor section of the processor detail page, upload the local version of the sample form. This takes you to the document analysis page where you can view the document annotations returned.

    annotated sample form in UI

Clean up

To avoid incurring charges to your Google Cloud account for the resources used on this page, follow these steps.

To avoid unnecessary Google Cloud charges, use the console to delete your processor and project if you do not need them.

What's next