> 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/relay/create-a-relay/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.withpersona.com/_mcp/server. # Create a Relay POST https://api.withpersona.com/api/privacy/v1/relays Content-Type: application/json Creates a new Relay. Reference: https://docs.withpersona.com/api-reference/relay/create-a-relay ## Request ### Headers - `Key-Inflection` (enum, optional) — Determines casing for the API response. - Allowed values: `camel`, `kebab`, `snake` - `Persona-Version` (enum, optional) — Server API version. More info on versioning can be found [here](https://docs.withpersona.com/versioning). - Allowed values: `2025-12-08`, `2025-10-27`, `2023-01-05`, `2022-09-01`, `2021-08-18`, `2021-07-05`, `2021-02-21`, `2020-05-18` ### Body (application/json) This endpoint expects an object. - `claim-type` (string, required) — Possible values: - live_human_presence - age_over18_germany - age_over18_united_kingdom - age_over18_verified - age_over18_france - age_over18_italy - age_over18_brazil - age_over18_australia - age_over16_australia - age_over21_verified Do not assume this is a static enumeration; Persona may add new claim types in the future without a versioned update. - `encryption-key-pem` (string, required, nullable) — RSA public key (PEM-encoded, 2048-4096 bits). When non-null, claim payloads returned by subsequent reads will be encrypted with RSA OAEP. Pass `null` to receive unencrypted claim payloads. - `sandbox` (boolean, optional) — When true, the Relay is created in a sandbox environment and uses the sandbox Privacy Pass namespace; sandbox passes are only redeemable against sandbox Relays. When omitted or false, the Relay is created in a production environment and uses the claim-type namespace. ## Response ### 201 Returns the Relay tokens needed to redeem and read the claim. - `relay-token` (string, required) — Public Relay identifier. Use this token in subsequent calls to `/relays/{relay-token}/generate-claim`. - `relay-secret` (string, required) — Secret value tied to this Relay. Returned only at creation and must be passed in the `Persona-Relay-Secret` header for any read of the claim payload. - `relay-session-access-token` (string, required) — Encoded JWT used by Persona's client SDK to load the associated Inquiry Session in the end-user's browser or device. ## Errors ### 400 Bad Request Error The request was unacceptable, often due to invalid parameters. - `errors` (list of RelaysPostResponsesContentApplicationJsonSchemaErrorsItems, optional) ### 401 Unauthorized Error An invalid API key was provided. - `errors` (list of RelaysPostResponsesContentApplicationJsonSchemaErrorsItems, 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 RelaysPostResponsesContentApplicationJsonSchemaErrorsItems, optional) ### 409 Conflict Error The request conflicts with another request, often due to attempting to create a duplicate resource. - `errors` (list of RelaysPostResponsesContentApplicationJsonSchemaErrorsItems, 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 RelaysPostResponsesContentApplicationJsonSchemaErrorsItems, optional) ### 429 Too Many Requests Error Your organization’s rate limit has been exceeded. We recommend an exponential backoff on requests. - `errors` (list of RelaysPostResponsesContentApplicationJsonSchemaErrorsItems, optional) ## Types ### RelaysPostResponsesContentApplicationJsonSchemaErrorsItems - `title` (string, optional) - `details` (string, optional) ## Examples **Request** ```json { "claim-type": "live_human_presence", "encryption-key-pem": null } ``` **Response** ```json { "relay-token": "relay_AbcDeFGhIjKlMnOpQrStUvWxYz1", "relay-secret": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d", "relay-session-access-token": "eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJyZWxzZXNzX0FiYyJ9.signature" } ``` **SDK Code** ```python Created import requests url = "https://api.withpersona.com/api/privacy/v1/relays" payload = { "claim-type": "live_human_presence", "encryption-key-pem": None } headers = {"Content-Type": "application/json"} response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Created const url = 'https://api.withpersona.com/api/privacy/v1/relays'; const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"claim-type":"live_human_presence","encryption-key-pem":null}' }; 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/privacy/v1/relays" payload := strings.NewReader("{\n \"claim-type\": \"live_human_presence\",\n \"encryption-key-pem\": null\n}") req, _ := http.NewRequest("POST", url, payload) 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/privacy/v1/relays") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = 'application/json' request.body = "{\n \"claim-type\": \"live_human_presence\",\n \"encryption-key-pem\": null\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/privacy/v1/relays") .header("Content-Type", "application/json") .body("{\n \"claim-type\": \"live_human_presence\",\n \"encryption-key-pem\": null\n}") .asString(); ``` ```php Created request('POST', 'https://api.withpersona.com/api/privacy/v1/relays', [ 'body' => '{ "claim-type": "live_human_presence", "encryption-key-pem": null }', 'headers' => [ 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp Created using RestSharp; var client = new RestClient("https://api.withpersona.com/api/privacy/v1/relays"); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"claim-type\": \"live_human_presence\",\n \"encryption-key-pem\": null\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Created import Foundation let headers = ["Content-Type": "application/json"] let parameters = [ "claim-type": "live_human_presence", "encryption-key-pem": ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.withpersona.com/api/privacy/v1/relays")! 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() ```