---
title: "Trigger an api-entries block in a flow"
method: POST
path: "/flows/{flowId}/api-entries/{blockId}"
tags: ["Flows"]
---

# Trigger an api-entries block in a flow

`POST /flows/{flowId}/api-entries/{blockId}`

## Request

- Base URL: `https://api.loopify.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.loopify.com/flows/{flowId}/api-entries/{blockId}`
- Auth: one of:
  - HTTP bearer
  - OAuth 2 (authorization code, authorization URL `https://auth.loopify.com/connect/authorize`, token URL `https://auth.loopify.com/token`, scopes: `User`)

#### Auth policies: User 

 Use this endpoint to trigger an api entry block in a flow.  

Call this endpoint with the same jsonBody you used when mapping the block (must be done before calling this)
### Options (optional):

If you choose to include the options you must pass the contacts like this:

    {
        "options": {
            "addToSegment": "segments.customers", //"status.active" etc.
            "clearSegment": true, //if true, removes the segment values from all other contacts
            "enableValidation": false, //if true, response includes an array of non-imported contacts
        },
        "contacts": [{
            "firstName": "",
            ...
        },
        ...
        ]
    }
    

Example of response if enableValidation is true

	{
		status: "error|success",
		errors: [
			"email: 'test@test@gftdf.no' failed at line 123",
			"mobile: '+95678762 4' failed at line 23",
		]
	}
	
NOTE: Partial validation fails will return a 200 (OK), so be sure to check the errors array in the response. 
If all contacts fails, a 400 (BadRequest) is returned.

NOTE: When useBackgroundTask=true, the response is returned before the complete payload has been processed. 
This can be used to prevent request timeouts. 
Please note that validation messages will not be returned in the response (status code 202 - Accepted).

## Path parameters

- `flowId` string, required
- `blockId` string, required

## Query parameters

- `useBackgroundTask` boolean

## Request body

- unknown

## Response `200`

Success

- ApiEntryResult
  - `status` string, nullable
  - `errors` string[], nullable

## Other responses

- `202`: Accepted - useBackgroundTask=true
- `400`: 0: Json body is invalid 1: Flow could not be found 2: Flow-block is missing a mapping 3: Flow is inactive 4: Flow block does not exist in the flow 5: addToSegment is not valid (should contain a dot (segments.customers) 6: jsonBody was missing a contacts object/array 7: License issue
- `401`: Unauthorized
- `403`: Forbidden

---

[API](https://skmtc.dev/loopify/apis/web-api-loopify.md) · [All operations](https://skmtc.dev/loopify/apis/web-api-loopify/llms.txt) · [OpenAPI document](https://skmtc.dev/loopify/apis/web-api-loopify/revisions/68c51b11a24b?raw)
