---
agentTools:
  projectIndex: https://docs.developer.yelp.com/llms.txt
---

# Get Lead Metrics

Returns the metrics belonging to a given Lead ID.

## Example
To fetch the metrics belonging to a lead with the ID "jPlz8TM628rzyCRPqrtcvm", send an [authenticated](https://docs.developer.yelp.com/docs/authorization-code-workflow) GET request to the following URL:
```
https://api.yelp.com/v3/leads/jPlz8TM628rzyCRPqrtcvm/metrics
```
For the above request, a successful GET call would return the lead metrics if they exist in our system.
A sample response is shown in the example response box on the right under "200 - Metrics"


#### API Responses

```json
{ "metrics": { "cost_per_lead": { "value": 0, "currency_code": "USD" } } }
```

# OpenAPI definition

````json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Leads",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.yelp.com/v3/"
    }
  ],
  "components": {
    "securitySchemes": {
      "oauth2": {
        "type": "oauth2",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://biz.yelp.com/oauth2/authorize",
            "tokenUrl": "https://api.yelp.com/oauth2/token/v3",
            "scopes": {
              "leads": "Access Yelp Leads on your behalf, including reading and responding to messages, and storing message data"
            }
          }
        }
      }
    },
    "examples": {
      "InvalidLeadIDError": {
        "value": {
          "error": {
            "code": "INVALID_ID",
            "description": "The ID provided is not valid.",
            "lead_id": "<the invalid ID>"
          }
        }
      },
      "GetMetrics": {
        "value": {
          "metrics": {
            "cost_per_lead": {
              "value": 0,
              "currency_code": "USD"
            }
          }
        }
      }
    },
    "schemas": {
      "RequiredLeadID": {
        "name": "ID",
        "in": "path",
        "description": "The Yelp Lead ID",
        "schema": {
          "type": "string"
        },
        "required": true
      },
      "LeadCost": {
        "type": "object",
        "properties": {
          "value": {
            "description": "Amount of the lead cost, represented in cents.",
            "type": "integer"
          },
          "currency_code": {
            "description": "The currency code.",
            "type": "string"
          }
        },
        "required": [
          "value",
          "currency_code"
        ]
      },
      "GetMetricsResponse": {
        "type": "object",
        "properties": {
          "metrics": {
            "description": "The lead metrics such as Cost per Lead.\n",
            "type": "object",
            "properties": {
              "cost_per_lead": null,
              "$ref": "#/components/schemas/LeadCost"
            },
            "required": [
              "cost_per_lead"
            ]
          }
        },
        "required": [
          "metrics"
        ]
      },
      "Error400GetLead": {
        "description": "The provided ID is not recognized as a valid Yelp Lead ID",
        "content": {
          "application/json": {
            "examples": {
              "Invalid Lead ID": {
                "$ref": "#/components/examples/InvalidLeadIDError"
              }
            },
            "schema": {
              "$ref": "#/components/schemas/Error404/content/application~1json/schema"
            }
          }
        }
      },
      "Error403Read": {
        "description": "This error is returned in any of the following scenarios:\n- The business isn't currently advertising.\n- The business user doesn't have access to the business.\n\n| code  | description |\n| ------------- | ------------- |\n| UNAUTHORIZED_BUSINESS_MINIMUM_ADVERTISING  | \"You're not authorized to access this business as it does not meet minimum advertising requirements.\"  |\n| NO_BUSINESS_ACCESS | \"You don't have access to this Business.\" |\n",
        "content": {
          "application/json": {
            "examples": {
              "Business must be Advertising": {
                "value": {
                  "error": {
                    "code": "UNAUTHORIZED_BUSINESS_MINIMUM_ADVERTISING",
                    "description": "You're not authorized to access this business as it does not meet minimum advertising requirements."
                  }
                }
              }
            },
            "schema": {
              "$ref": "#/components/schemas/Error404/content/application~1json/schema"
            }
          }
        }
      },
      "Error404": {
        "description": "The Lead with the given ID was not found.",
        "content": {
          "application/json": {
            "examples": {
              "Not Found": {
                "value": {
                  "error": {
                    "code": "NOT_FOUND",
                    "description": "Resource could not be found"
                  }
                }
              }
            },
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "object",
                  "required": [
                    "code",
                    "description"
                  ],
                  "properties": {
                    "code": {
                      "type": "string",
                      "description": "The error code."
                    },
                    "description": {
                      "type": "string",
                      "description": "The description of the error."
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "security": [
    {
      "oauth2": [
        "leads"
      ]
    }
  ],
  "paths": {
    "/leads/{ID}": {
      "get": {
        "tags": [
          "Leads"
        ],
        "summary": "Get Lead",
        "description": "Returns details for a given Lead ID.\n\nExample:\nTo fetch the details for a lead with the ID `jPlz8TM628rzyCRPqrtcvm`, send an [authenticated](https://docs.developer.yelp.com/docs/authorization-code-workflow) GET request to the following URL:\nhttps://api.yelp.com/v3/leads/jPlz8TM628rzyCRPqrtcvm\n\nA sample response is shown in the example response box on the right under \"200 - Lead\"\n",
        "operationId": "get-lead",
        "parameters": [
          {
            "$ref": "#/components/schemas/RequiredLeadID"
          }
        ],
        "responses": {
          "200": {
            "description": "The lead details were fetched successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadObject"
                },
                "examples": {
                  "Lead": {
                    "value": {
                      "id": "18kPq7GPye-YQ3LyKyAZPw",
                      "business_id": "VXi7gzRqPKp63X0u6fUtbg",
                      "conversation_id": "E24Bu-vMhVpueQpU8mpRPw",
                      "temporary_email_address": "gbtUf6u0X36pKPqRzg7iXV@messaging.yelp.com",
                      "temporary_email_address_expiry": "2022-01-02T03:04:05+00:00",
                      "phone_number": "+14166666666",
                      "temporary_phone_number": "+14166666666",
                      "temporary_phone_number_expiry": "2099-12-31T23:59:59+00:00",
                      "time_created": "2022-01-02T03:04:05+00:00",
                      "last_event_time": "2022-01-02T04:04:05+00:00",
                      "link_to_reply_in_yelp": "https://biz.yelp.com/leads_center/VXi7gzRqPKp63X0u6fUtbg/leads/18kPq7GPye-YQ3LyKyAZPw",
                      "user": {
                        "display_name": "Jeremy S."
                      },
                      "project": {
                        "location": {
                          "postal_code": "12345"
                        },
                        "additional_info": "Moving items out of my storage unit in Louisburg to Red Oak",
                        "availability": {
                          "status": "SPECIFIC_DATES",
                          "dates": [
                            "2024-08-01",
                            "2024-08-02",
                            "2024-08-06"
                          ]
                        },
                        "job_names": [
                          "In-state moving"
                        ],
                        "survey_answers": [
                          {
                            "question_text": "Where are you moving to?",
                            "question_identifier": "moving_to",
                            "answer_text'": [
                              "Read Oak, NC"
                            ]
                          },
                          {
                            "question_text'": "What is the size of your move?",
                            "question_identifier": "move_size",
                            "answer_text": [
                              "3 bedroom home"
                            ]
                          },
                          {
                            "question_text": "Do you need items moved up or down floors at your current location? If so, how many floors?",
                            "question_identifier": "current_floors",
                            "answer_text": [
                              "1 floor"
                            ]
                          },
                          {
                            "question_text": "Do you need items moved up or down floors at your destination? If so, how many floors?",
                            "question_identifier": "destination_floors",
                            "answer_text": [
                              "None (unit is on the ground floor)"
                            ]
                          },
                          {
                            "question_text": "Do you need any assistance preparing for your move? (e.g. furniture disassembly, packing items into boxes, etc)",
                            "question_identifier": null,
                            "answer_text": [
                              "No"
                            ]
                          }
                        ],
                        "attachments": [
                          {
                            "id": "Tm-b0FNkwrfM-GTPFYWvfg",
                            "url": "https://yelp.com/image.jpg",
                            "resource_name": "image.jpg",
                            "mime_type": "image/jpeg"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/schemas/Error400GetLead"
          },
          "401": {
            "description": "The API key has either expired or doesn't have the required scopes to query this endpoint.\n\n| code  | description |\n| ------------- | ------------- |\n| UNAUTHORIZED_API_KEY  | The API key provided is not currently able to query this endpoint.  |\n| TOKEN_INVALID  | Invalid API key or authorization header.  |\n",
            "content": {
              "application/json": {
                "examples": {
                  "Unauthorized": {
                    "value": {
                      "error": {
                        "code": "UNAUTHORIZED_API_KEY",
                        "description": "The API key provided is not currently able to query this endpoint."
                      }
                    }
                  },
                  "Invalid Token": {
                    "value": {
                      "error": {
                        "code": "TOKEN_INVALID",
                        "description": "Invalid API key or authorization header."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error404/content/application~1json/schema"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/schemas/Error403Read"
          },
          "404": {
            "$ref": "#/components/schemas/Error404"
          },
          "429": {
            "description": "You have either exceeded your daily quota, or have exceeded the queries-per-second limit for this endpoint. Try reducing the rate at which you make queries.",
            "content": {
              "application/json": {
                "examples": {
                  "Rate limited": {
                    "value": {
                      "error": {
                        "code": "TOO_MANY_REQUESTS_PER_SECOND",
                        "description": "You have exceeded the queries-per-second limit for this endpoint. Try reducing the rate at which you make queries."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error404/content/application~1json/schema"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "examples": {
                  "Internal Server Error": {
                    "value": {
                      "error": {
                        "code": "INTERNAL_ERROR",
                        "description": "Something went wrong internally, please try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Error404/content/application~1json/schema"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/leads/{ID}/metrics": {
      "get": {
        "tags": [
          "Leads"
        ],
        "summary": "Get Lead Metrics",
        "description": "Returns the metrics belonging to a given Lead ID.\n\n## Example\nTo fetch the metrics belonging to a lead with the ID \"jPlz8TM628rzyCRPqrtcvm\", send an [authenticated](https://docs.developer.yelp.com/docs/authorization-code-workflow) GET request to the following URL:\n```\nhttps://api.yelp.com/v3/leads/jPlz8TM628rzyCRPqrtcvm/metrics\n```\nFor the above request, a successful GET call would return the lead metrics if they exist in our system.\nA sample response is shown in the example response box on the right under \"200 - Metrics\"\n\n\n#### API Responses\n\n```json\n{ \"metrics\": { \"cost_per_lead\": { \"value\": 0, \"currency_code\": \"USD\" } } }\n```\n",
        "operationId": "get-lead-metrics",
        "parameters": [
          {
            "$ref": "#/components/schemas/RequiredLeadID"
          }
        ],
        "responses": {
          "200": {
            "description": "Metrics of the lead.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetMetricsResponse"
                },
                "examples": {
                  "Metrics": {
                    "$ref": "#/components/examples/GetMetrics"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/schemas/Error400GetLead"
          },
          "401": {
            "$ref": "#/paths/~1leads~1{ID}/get/responses/401"
          },
          "403": {
            "$ref": "#/components/schemas/Error403Read"
          },
          "404": {
            "$ref": "#/components/schemas/Error404"
          },
          "429": {
            "$ref": "#/paths/~1leads~1{ID}/get/responses/429"
          },
          "500": {
            "$ref": "#/paths/~1leads~1{ID}/get/responses/500"
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": false,
    "samples-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 98,
      "1": 152,
      "2": 120,
      "3": 146,
      "4": 124,
      "5": 89,
      "6": 87,
      "7": 0,
      "8": 35,
      "9": 78,
      "10": 32,
      "11": 216
    }
  }
}
````