Graph API Version

Lead Gen Data

Reading

A lead ad form

Example

Graph API Explorer
GET /v5.0/{lead-gen-data-id} 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(
    '/{lead-gen-data-id}',
    '{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(
    "/{lead-gen-data-id}",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{lead-gen-data-id}",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
// For more complex open graph stories, use `FBSDKShareAPI`
// with `FBSDKShareOpenGraphContent`
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{lead-gen-data-id}"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];
If you want to learn how to use the Graph API, read our Using Graph API guide.

Parameters

This endpoint doesn't have any parameters.

Fields

FieldDescription
id
numeric string

The ID of the Lead Ad Form

allow_organic_lead
bool

Include organic lead for this form

block_display_for_non_targeted_viewer
bool

Flag to indicate whether non targeted viewers should be blocked from seeing the Lead Ad form

context_card
LeadGenContextCard

The context card of this Lead Ad Form

created_time
datetime

The time the LeadGenData was created

expired_leads_count
unsigned int32

Number of leads submitted for this form that have since expired

follow_up_action_text
string

The displayed label on the follow up action when the user completes the form

follow_up_action_url
string

The URL that the follow_up_action_text will take them to on click

is_optimized_for_quality
bool

Flag to indicate whether the form will be optimized for quality

leads_count
unsigned int32

Total number of Leads for a given Form

legal_content
LeadGenLegalContent

The legal content of this Lead Ad Form

locale
string

The locale of contents in this lead gen ad

name
string

The name of LeadGen Ad Form name

organic_leads_count
unsigned int32

Total number of Organic Leads for a given Form

page

The page that this form belongs to

page_id
numeric string

The ID of the page that this form belongs to

privacy_policy_url
string

The URL to the advertiser's privacy policy

question_page_custom_headline
string

Custom headline for question page within a lead form

questions
list<LeadGenQuestion>

The questions used in this form

status
string

The status of this Lead Ad Form: active, deleted, etc

thank_you_page
LeadGenThankYouPage

Optional customized thank you page displayed post submission

tracking_parameters
list<KeyValue:string,string>

Tracking parameters to include with this form's field data

Edges

EdgeDescription

The leads that were submitted to this lead gen data

The test lead that was submitted to this lead gen data

Validation Rules

ErrorDescription
100Invalid parameter
80005There 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.

Creating

You can make a POST request to test_leads edge from the following paths:
When posting to this edge, a LeadGenData will be created.

Parameters

ParameterDescription
custom_disclaimer_responses
list<Object>

Responses to custom disclaimer checkboxes.

checkbox_key
string

Required
is_checked
boolean

Required
field_data
list<Object>

Custom data for the forms field list.

name
string

Required
values
list<string>

Required

Return Type

This endpoint supports read-after-write and will read the node represented by id in the return type.
Struct {
id: numeric string,
}

Validation Rules

ErrorDescription
100Invalid parameter

Updating

You can update a LeadGenData by making a POST request to /{lead_gen_data_id}.

Parameters

ParameterDescription
status
enum {ACTIVE, ARCHIVED, DELETED, DRAFT}

The status of the lead ad form. It can be either ACTIVE, ARCHIVED, or DRAFT.

Return Type

This endpoint supports read-after-write and will read the node to which you POSTed.
Struct {
success: bool,
}

Validation Rules

ErrorDescription
80005There 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.
100Invalid parameter

Deleting

You can delete a LeadGenData by making a DELETE request to /{lead_gen_data_id}.

Parameters

This endpoint doesn't have any parameters.

Return Type

Struct {
success: bool,
}

Validation Rules

ErrorDescription
210User not visible