Update Meta measurement settings
Changes the fields it names; null removes one.
Secrets are stored encrypted and never returned. Conversions go only for people whose $ad_data_sharing trait is true, and turning them on sends only purchases made from then on. Needs project:ads:manage.
Guide: Share purchases with Meta
A project secret key: vh_sk_... for production, vh_sk_test_... for test. Keep it on your servers.
In: header
Path parameters
The project's id, proj_.... A secret key works only in the project it belongs to.
Request body
application/json
TypeScript definitions
Use the request body type in TypeScript.
The install referrer decryption key Meta shows for the app, 64 hexadecimal characters; null removes it. Write-only.
Whether to send purchases to Meta's Conversions API. Turning it on needs a dataset and a token, and sends only purchases made from then on.
The dataset (pixel) id from Meta's Events Manager, digits only; null removes it, which is refused while conversions are on.
An access token for the dataset, from Meta's Events Manager, at most 4096 characters; null removes it, which is refused while conversions are on. Write-only.
The code from Meta's Test Events tab, such as TEST12345: letters, digits, _ and -, at most 64; null removes it and Meta counts the events again.
Examples
curl -X PATCH "https://api.voidhash.com/api/v1/projects/proj_tz4a98xxat96iws9zmbrgj3a/ads/meta-measurement/settings" \ -H "Authorization: Bearer vh_sk_..." \ -H "Content-Type: application/json" \ -d '{ "isConversionsEnabled": true, "conversionsDatasetId": "1234567890123456", "conversionsToken": "EAAB..." }'{ "projectId": "proj_tz4a98xxat96iws9zmbrgj3a", "hasInstallReferrerKey": true, "installReferrerLastError": null, "installReferrerLastErrorAt": null, "isConversionsEnabled": true, "conversionsDatasetId": "1234567890123456", "hasConversionsToken": true, "conversionsTestEventCode": null, "conversionsLastSentAt": null, "conversionsLastRunAt": "2026-03-02T10:00:00.000Z", "conversionsLastError": null, "conversionsLastErrorAt": null, "conversionsLastErrorKind": null, "conversionsSkippedTotal": 0, "conversionsRefusedInARow": 0, "conversionsWithheld": { "noAdDataSharing": 0, "noMatchKey": 0, "personGone": 0, "reversed": 0 }}{ "error": { "type": "invalid_request", "code": "conversions_not_configured", "message": "Conversions need an access token to be on.", "param": "conversionsToken" }}{ "error": { "type": "unauthenticated", "code": "invalid_api_key", "message": "This secret key is not valid." }}{ "error": { "type": "permission_denied", "code": "permission_denied", "message": "Insufficient permissions." }}{ "error": { "type": "not_found", "code": "project_not_found", "message": "There is no project proj_tz4a98xxat96iws9zmbrgj3a, or this credential cannot use it.", "param": "projectId" }}{ "error": { "type": "internal", "code": "internal_error", "message": "Something went wrong on our side. Try again, and contact support with the Request-Id header if it keeps failing." }}Response body
application/json
application/json
application/json
application/json
application/json
application/json
Errors
| Status | type | code | When |
|---|---|---|---|
| 400 | invalid_request | conversions_not_configured | To turn conversions on without both a dataset and a token. |
| 400 | invalid_request | invalid_install_referrer_key | For a malformed value, with param naming the field. |
| 400 | invalid_request | invalid_dataset_id | For a malformed value, with param naming the field. |
| 400 | invalid_request | invalid_conversions_token | For a malformed value, with param naming the field. |
| 400 | invalid_request | invalid_test_event_code | For a malformed value, with param naming the field. |
It can also fail with the errors every operation shares, such as unauthenticated; see Errors.
More in Meta measurement
Something wrong or missing on this page? Tell us by email or on Discord.