logo-darkPipe0

Introduction

Making requests

This request enriches one input object. The pipe person:workemail:waterfall@1 adds a field called work_email to your input objects. You can find all available enrichments in the pipe catalog.

const result = await fetch("https://api.pipe0.com/v1/pipes/run", {
    method: "POST",
    headers: {
        "Authorization": `Bearer ${API_KEY}`,
        "Content-Type": "application/json"
    },
    body: JSON.stringify({
        pipes: [
            {
                pipe_id: "person:workemail:waterfall@1"
            }
        ],
        input: [
            {
                id: 1,
                name: "John Doe",
                company_domain: "pipe0.com"
            }
        ]
    })
});

The result will look something like this:

Response
{
  "id": "xgvxuqk2771d8t17n60vphu9",
  "status": "completed",
  "records": {
    "1": {
      "id": 1,
      "fields": {
        "work_email": {
          "type": "string",
          "value": "john@pipe0.com",
          "status": "completed"
          // ...
        }
        // ...
      }
    }
  }
  // ...
}

The response will contain more information than displayed here. Learn how to work with response objects.

Getting the task result

The request to POST https://api.pipe0.com/v1/pipes/run will create an enrichment task. To get the result of the task, poll the GET https://api.pipe0.com/v1/pipes/check/{run_id} endpoint until the task status is completed.

const result = await fetch(`https://api.pipe0.com/v1/pipes/check/${runId}`, {
    method: "GET",
    headers: {
        "Authorization": `Bearer ${API_KEY}`
    }
});

Getting the result without polling

Instead of creating your task with the endpoint POST https://api.pipe0.com/v1/pipes/run use the endpoint POST https://api.pipe0.com/v1/pipes/run/sync. Use the same payload for both endpoints. The /sync endpoint will try to return the completed result in one round-trip.

Read more about the trade-offs between async and sync requests.

Next steps

On this page