> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.withpersona.com/2020-05-18/api-reference/graph/create-a-graph-query/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.withpersona.com/_mcp/server. # Create a Graph Query POST https://api.withpersona.com/api/v1/graph-queries Content-Type: application/json Create a Graph Query Reference: https://docs.withpersona.com/api-reference/graph/create-a-graph-query ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Request ### Query parameters - `include` (string, optional) — A comma-separated list of relationship paths. This can be used to customize which related resources will be fully serialized in the `included` key in the response. See [Serialization](https://docs.withpersona.com/serialization#inclusion-of-related-resources) for more details. - `fields` (map from string to string, optional) — Comma-separated list(s) of attributes to include in the response. This can be used to customize which attributes will be serialized in the response. See [Serialization](https://docs.withpersona.com/serialization#sparse-fieldsets) for more details. ### Body (application/json) This endpoint expects an object. - `data` (GraphQueriesPostRequestBodyContentApplicationJsonSchemaData, required) - `meta` (GraphQueriesPostRequestBodyContentApplicationJsonSchemaMeta, optional) ## Response ### 201 This endpoint returns a Graph Query object and (optionally) its related objects in `included`. - `data` (graph-query, required) — A Graph Query object - `included` (list of account, optional) — Optional included resources, requested via the `include` query parameter. ## Errors ### 400 Bad Request Error The request was unacceptable, often due to invalid parameters. - `errors` (list of GraphQueriesPostResponsesContentApplicationJsonSchemaErrorsItems, optional) ### 401 Unauthorized Error An invalid API key was provided. - `errors` (list of GraphQueriesPostResponsesContentApplicationJsonSchemaErrorsItems, optional) ### 403 Forbidden Error The given API key doesn’t have permissions to perform the request or a quota has been exceeded. - `errors` (list of GraphQueriesPostResponsesContentApplicationJsonSchemaErrorsItems, optional) ### 404 Not Found Error The requested resource doesn’t exist. - `errors` (list of GraphQueriesPostResponsesContentApplicationJsonSchemaErrorsItems, optional) ### 409 Conflict Error The request conflicts with another request, often due to attempting to create a duplicate resource. - `errors` (list of GraphQueriesPostResponsesContentApplicationJsonSchemaErrorsItems, optional) ### 422 Unprocessable Entity Error The request modifies the resource in an unacceptable way, often due to an invalid action or parameter. - `errors` (list of GraphQueriesPostResponsesContentApplicationJsonSchemaErrorsItems, optional) ### 429 Too Many Requests Error Your organization’s rate limit has been exceeded. We recommend an exponential backoff on requests. - `errors` (list of GraphQueriesPostResponsesContentApplicationJsonSchemaErrorsItems, optional) ## Types ### GraphQueriesPostRequestBodyContentApplicationJsonSchemaData - `attributes` (GraphQueriesPostRequestBodyContentApplicationJsonSchemaDataAttributes, required) ### GraphQueriesPostRequestBodyContentApplicationJsonSchemaMeta - `run-sync` (boolean, optional, default: false) — If true, the query will run synchronously and results will be returned in the response. If false, the query will run asynchronously and you will have to poll for results. ### graph-query A Graph Query object - `type` ("graph-query", optional) - `id` (string, optional) - `attributes` (GraphQueryAttributes, optional) - `relationships` (GraphQueryRelationships, optional) ### account An Account object. Note that `fields` is **not** key inflected. - `id` (string, optional) - `attributes` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributes, optional) - `relationships` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountRelationships, optional) ### GraphQueriesPostResponsesContentApplicationJsonSchemaErrorsItems - `title` (string, optional) - `details` (string, optional) ### GraphQueriesPostRequestBodyContentApplicationJsonSchemaDataAttributes - `graph-query-template-id` (string, required) - `parameter-map` (map from string to any, optional) — Required. JSON key-value pairs of parameter name to value. Schema is defined by your Graph Query Template. - `timeout-in-seconds` (integer, optional) — Number of seconds from now to timeout the graph query. Must be greater than 0 and less than 60. - `variable-map` (map from string to any, optional, deprecated) — Deprecated, use parameter-map instead. JSON key-value pairs of variable name to value. Schema is defined by your Graph Query Template. ### GraphQueryAttributes - `status` (string, optional) — Possible values: - submitted - completed - errored - cancelled - timed_out Do not assume this is a static enumeration; Persona may add new values in the future without a versioned update. - `params` (map from string to any, optional) — Dynamic query parameters - `created-at` (datetime, optional) - `updated-at` (datetime, optional, nullable) - `errored-at` (datetime, optional, nullable) - `completed-at` (datetime, optional, nullable) - `redacted-at` (datetime, optional, nullable) — This will be set to the time when the graph query results were redacted. In this case, nodes will also be an empty array. ### GraphQueryRelationships - `accounts` (GraphQueryRelationshipsAccounts, optional) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributes - `reference-id` (string, optional, nullable) - `account-type-name` (string, optional) - `created-at` (datetime, optional) - `updated-at` (datetime, optional) - `redacted-at` (datetime, optional, nullable) - `fields` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFields, optional) — JSON key-value pairs of field name to field value. Exact schema depends on the configuration of the Account Type for this Account. Keys in `fields` are **not** key inflected. - `tags` (list of string, optional) - `account-status` (string, optional) - `birthdate` (date, optional, nullable) — Birthdate, must be in the format "YYYY-MM-DD". - `name-first` (string, optional, nullable) — Given or first name. - `name-middle` (string, optional, nullable) — Middle name. - `name-last` (string, optional, nullable) — Family or last name. - `phone-number` (string, optional, nullable) — Phone number. - `email-address` (string, optional, nullable) — Email address. - `address-street-1` (string, optional, nullable) — Street name of residence address. - `address-street-2` (string, optional, nullable) — Extension of residence address, usually apartment or suite number. - `address-city` (string, optional, nullable) — City of residence address. Not all international addresses use this attribute. - `address-subdivision` (string, optional, nullable) — State or subdivision of residence address. In the US, this should be the unabbreviated name. Not all international addresses use this attribute. - `address-postal-code` (string, optional, nullable) — ZIP or postal code of residence address. Not all international addresses use this attribute. - `country-code` (string, optional, nullable) — ISO 3166-1 alpha 2 country code. - `identification-numbers` (map from string to list of VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesIdentificationNumbersItems, optional) — Keys will be the identification class - `social-security-number` (string, optional, nullable) — Social security number. ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountRelationships - `account-type` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountRelationshipsAccountType, optional) ### GraphQueryRelationshipsAccounts - `data` (list of GraphQueryRelationshipsAccountsDataItems, optional) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFields JSON key-value pairs of field name to field value. Exact schema depends on the configuration of the Account Type for this Account. Keys in `fields` are **not** key inflected. - `name` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsName, optional) - `address` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsAddress, optional) - `identification_numbers` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsIdentificationNumbers, optional) - `birthdate` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsBirthdate, optional) - `phone_number` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsPhoneNumber, optional) - `email_address` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsEmailAddress, optional) - `selfie_photo` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsSelfiePhoto, optional) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesIdentificationNumbersItems - `issuing-country` (string, optional) - `identification-class` (string, optional) - `identification-number` (string, optional) - `created-at` (datetime, optional) - `updated-at` (datetime, optional) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountRelationshipsAccountType - `data` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountRelationshipsAccountTypeData, optional) ### GraphQueryRelationshipsAccountsDataItems - `id` (string, optional) - `type` ("account", optional) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsName - `type` (string, optional) - `value` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsNameValue, optional) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsAddress - `type` (string, optional) - `value` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsAddressValue, optional) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsIdentificationNumbers - `type` (string, optional) - `value` (list of VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsIdentificationNumbersValueItems, optional) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsBirthdate - `type` (string, optional) - `value` (string, optional, nullable) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsPhoneNumber - `type` (string, optional) - `value` (string, optional, nullable) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsEmailAddress - `type` (string, optional) - `value` (string, optional, nullable) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsSelfiePhoto - `type` ("file", optional) - `value` (File, optional, nullable) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountRelationshipsAccountTypeData - `id` (string, optional) - `type` ("account-type", optional) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsNameValue - `first` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsNameValueFirst, optional) - `middle` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsNameValueMiddle, optional) - `last` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsNameValueLast, optional) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsAddressValue - `street_1` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsAddressValueStreet1, optional) - `street_2` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsAddressValueStreet2, optional) - `subdivision` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsAddressValueSubdivision, optional) - `city` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsAddressValueCity, optional) - `postal_code` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsAddressValuePostalCode, optional) - `country_code` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsAddressValueCountryCode, optional) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsIdentificationNumbersValueItems - `type` (string, optional) - `value` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsIdentificationNumbersValueItemsValue, optional) ### File - `filename` (string, optional) - `url` (string, optional) - `byte-size` (integer, optional) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsNameValueFirst - `type` (string, optional) - `value` (string, optional, nullable) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsNameValueMiddle - `type` (string, optional) - `value` (string, optional, nullable) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsNameValueLast - `type` (string, optional) - `value` (string, optional, nullable) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsAddressValueStreet1 - `type` (string, optional) - `value` (string, optional, nullable) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsAddressValueStreet2 - `type` (string, optional) - `value` (string, optional, nullable) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsAddressValueSubdivision - `type` (string, optional) - `value` (string, optional, nullable) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsAddressValueCity - `type` (string, optional) - `value` (string, optional, nullable) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsAddressValuePostalCode - `type` (string, optional) - `value` (string, optional, nullable) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsAddressValueCountryCode - `type` (string, optional) - `value` (string, optional, nullable) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsIdentificationNumbersValueItemsValue - `identification_class` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsIdentificationNumbersValueItemsValueIdentificationClass, optional) - `identification_number` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsIdentificationNumbersValueItemsValueIdentificationNumber, optional) - `issuing_country` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsIdentificationNumbersValueItemsValueIssuingCountry, optional) - `hashed_identification_number` (VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsIdentificationNumbersValueItemsValueHashedIdentificationNumber, optional) — A SHA-256 hash of the identification number, keyed on organization, country code, identification class, and issuing subdivision. Stable across re-verifications of the same document for the same organization. Null when the identification number has not been hashed. ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsIdentificationNumbersValueItemsValueIdentificationClass - `type` (string, optional) - `value` (string, optional) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsIdentificationNumbersValueItemsValueIdentificationNumber - `type` (string, optional) - `value` (string, optional) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsIdentificationNumbersValueItemsValueIssuingCountry - `type` (string, optional) - `value` (string, optional) ### VerificationIncludedObjectsItemsDiscriminatorMappingAccountAttributesFieldsIdentificationNumbersValueItemsValueHashedIdentificationNumber A SHA-256 hash of the identification number, keyed on organization, country code, identification class, and issuing subdivision. Stable across re-verifications of the same document for the same organization. Null when the identification number has not been hashed. - `type` (string, optional) - `value` (string, optional, nullable) ## Examples **Request** ```json { "data": { "attributes": { "graph-query-template-id": "string" } } } ``` **Response** ```json { "data": { "type": "graph-query", "id": "grphq_prM3gdSL6ciwGjSjj4aXgKJT", "attributes": { "status": "submitted", "params": { "": "" }, "created-at": "2023-09-1T06:30:44.000Z", "updated-at": null, "errored-at": null, "completed-at": null, "redacted-at": null } } } ``` **SDK Code** ```python Created import requests url = "https://api.withpersona.com/api/v1/graph-queries" payload = { "data": { "attributes": { "graph-query-template-id": "string" } } } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Created const url = 'https://api.withpersona.com/api/v1/graph-queries'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"data":{"attributes":{"graph-query-template-id":"string"}}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Created package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.withpersona.com/api/v1/graph-queries" payload := strings.NewReader("{\n \"data\": {\n \"attributes\": {\n \"graph-query-template-id\": \"string\"\n }\n }\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Created require 'uri' require 'net/http' url = URI("https://api.withpersona.com/api/v1/graph-queries") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"data\": {\n \"attributes\": {\n \"graph-query-template-id\": \"string\"\n }\n }\n}" response = http.request(request) puts response.read_body ``` ```java Created import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.withpersona.com/api/v1/graph-queries") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"data\": {\n \"attributes\": {\n \"graph-query-template-id\": \"string\"\n }\n }\n}") .asString(); ``` ```php Created request('POST', 'https://api.withpersona.com/api/v1/graph-queries', [ 'body' => '{ "data": { "attributes": { "graph-query-template-id": "string" } } }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp Created using RestSharp; var client = new RestClient("https://api.withpersona.com/api/v1/graph-queries"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"data\": {\n \"attributes\": {\n \"graph-query-template-id\": \"string\"\n }\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Created import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = ["data": ["attributes": ["graph-query-template-id": "string"]]] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.withpersona.com/api/v1/graph-queries")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```