Fetch LeadGen forms associated with a page
This operation requires a Page access token.
GET /v18.0/{page-id}/leadgen_forms HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->get(
'/{page-id}/leadgen_forms',
'{access-token}'
);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
/* make the API call */
FB.api(
"/{page-id}/leadgen_forms",
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/{page-id}/leadgen_forms",
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/{page-id}/leadgen_forms"
parameters:params
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];
Reading from this edge will return a JSON formatted result:
{ "
data
": [], "paging
": {} }
data
paging
Error | Description |
---|---|
200 | Permissions error |
80005 | There have been too many leadgen api calls to this Page account. Wait a bit and try again. For more info, please refer to https://developers.facebook.com/docs/graph-api/overview/rate-limiting. |
100 | Invalid parameter |
80001 | There have been too many calls to this Page account. Wait a bit and try again. For more info, please refer to https://developers.facebook.com/docs/graph-api/overview/rate-limiting. |
190 | Invalid OAuth 2.0 Access Token |
leadgen_forms
edge from the following paths: privacy_policy
if the URL is invalid or the link_text
exceeds 70 characters.
If you upload an image by specifying cover_photo
parameter, the access_token
accompanying the request must include the pages_manage_posts
permission.
Parameter | Description |
---|---|
allow_organic_lead_retrieval boolean | Default value: true Previously, this flag controlled whether any leads submitted in a non-Ad context were retrievable. Now this flag will not be considered and it will be deprecated entirely. To control visibility of Lead Forms in a non-Ad context you should use 'block_display_for_non_targeted_viewer' |
block_display_for_non_targeted_viewer boolean | Whether to make the organic post invisible to viewers in non-Ad context |
context_card Object | Optional context card shown as the intro page Supports Emoji |
cover_photo file | Custom cover photo for context card |
custom_disclaimer Object | Customized disclaimer including title, body content with inline links, and consent checkboxes |
follow_up_action_url URI | The final destination URL that user will go to when clicking view website button |
is_for_canvas boolean | Default value: false Flag to indicate that the form is going to be used under a canvas |
is_optimized_for_quality boolean | Default value: false Flag to indicate whether the form will be optimized for quality |
locale enum {AR_AR, CS_CZ, DA_DK, DE_DE, EL_GR, EN_GB, EN_US, ES_ES, ES_LA, FI_FI, FR_FR, HE_IL, HI_IN, HU_HU, ID_ID, IT_IT, JA_JP, KO_KR, NB_NO, NL_NL, PL_PL, PT_BR, PT_PT, RO_RO, RU_RU, SV_SE, TH_TH, TR_TR, VI_VN, ZH_CN, ZH_HK, ZH_TW} | The locale of the form. Pre-defined questions renders in this locale |
name string | The name that will help identity the form Required |
privacy_policy Object | The url and link_text of the privacy policy of advertiser. link_text is limited to a maximum of 70 characters. |
question_page_custom_headline string | The custom headline for the question page within the form |
questions list<Object> | An array of questions of the form Required |
thank_you_page Object | Optional customized thank you page displayed post submission |
tracking_parameters JSON object {string : string} | Map for additional tracking parameters to include with the form's field data |
id
in the return type.id
: numeric string, Error | Description |
---|---|
100 | Invalid parameter |
192 | Invalid phone number |
200 | Permissions error |
368 | The action attempted has been deemed abusive or is otherwise disallowed |