About Ads.txt

With Wix Ads.txt, site owners can define which Authorized Digital Sellers are allowed to sell digital advertisements on their site. This enables them to increase revenue, while ensuring security, privacy, and transparency.

The Ads.txt APIs allow your app to:

  • Retrieve an existing Ads.txt file
  • Append data to and update Ads.txt
  • Re-set Ads.txt to Wix’s default state

The Ads.txt project is a simple, flexible, and secure method for publishers and distributors to declare authorized sellers. Read more about Ads.txt and its functionality on the website of the Interactive Advertising Bureau (IAB).

Did this help?

Sample Use Case: Ads.txt

This article shares a possible use case for your app. You're certainly not limited to this use case, but it might be a helpful start to plan your app's implementation.

Enable the owner of a blog to display advertisements on their site through a content discovery platform

The owners of a fitness blog would like to increase revenue by displaying advertisements on their Wix site. Your app will modify the existing Ads.txt file to enable a content discovery platform as an authorized seller.

Append an existing Ads.txt file

To add an authorized digital seller, your app will call the Append Ads.txt endpoint. You’ll need to pass the platform’s name, account id, payment type, and tag id inside the content field of the adsTxt object. You can read more about the structure of Ads.txt files on the IAB’s website.

Copy
curl -X PATCH https://www.wixapis.com/promote-seo-txt-file-server/v2/ads \ --header 'Content-Type: application/json;charset=UTF-8' \ --header 'Authorization: <AUTH>' \ --data-binary '{"adsTxt": {"content": "silveradexchange.com, pub-0000000000000001, RESELLER, b124y6716v287058"}}'

Notice that the content field in the response has two lines, separated by the new line (\n) control character.

Copy
{ "adsTxt": { "content": "google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0\nsilveradexchange.com, pub-0000000000000001, RESELLER, b124y6716v287058", "default": false, "subdomain": "www" } }
Did this help?

Ads Txt Object


Properties
contentstring

Content of Ads.txt.


defaultboolean

Whether current Ads.txt is Wix's default.


subdomainstring

Subdomain of Ads.txt, for example www, es, fr. Default is www.

Did this help?

PUT

Update Ads Txt


Updates the Ads.txt file. When setting the content object to an empty string, an empty Ads.txt file will be created. In order to reset Ads.txt to Wix's default, send default: true without a content object.

Authentication

You can only call this method when authenticated as a Wix app or Wix user identity.

Permissions
Manage Ads.txt
Learn more about app permissions.
Endpoint
PUT
https://www.wixapis.com/promote-seo-robots-server/v2/ads

Body Params
adsTxtAdsTxt

Submitted adsTxT object will replace the existing Ads.txt file. To reset Ads.txt to Wix's default, submit default:true without a content object.

Response Object
adsTxtAdsTxt

Updated Ads txt object

Request
cURL
curl PUT https://www.wixapis.com/promote-seo-txt-file-server/v2/ads \ -H 'Content-Type: application/json;charset=UTF-8' \ -H 'Authorization: <AUTH>' \ -d '{"adsTxt": {"content": "google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0", "subdomain": "www"}}'
Response
JSON
{ "adsTxt": { "content": "google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0", "default": false, "subdomain": "www" } }
Errors
428Failed Precondition

There is 1 error with this status code:

See the entire list and learn more about Wix errors.

Event TriggersThis method triggers the following events:
Did this help?

GET

Get Ads Txt


Retrieves the Ads.txt file.

Authentication

You can only call this method when authenticated as a Wix app or Wix user identity.

Permissions
Manage Ads.txt
Learn more about app permissions.
Endpoint
GET
https://www.wixapis.com/promote-seo-robots-server/v2/ads

Query Params
subdomainstring

Subdomain of Ads.txt, for example www, es, fr. Default is www.

Response Object
adsTxtAdsTxt

Ads txt object

Get Ads.txt Example
Request
cURL
curl GET https://www.wix.com/_api/promote-seo-txt-file-server/v2/ads \ -H 'Content-Type: application/json;charset=UTF-8' \ -H 'Authorization: <AUTH>' \ -H 'subdomain: www'
Response
JSON
{ "adsTxt": { "content": "google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0", "default": false, "subdomain": "www" } }
Errors
428Failed Precondition

There is 1 error with this status code:

See the entire list and learn more about Wix errors.

Did this help?

PATCH

Append Ads Txt


Appends the submitted content object to Ads.txt. In order to reset Ads.txt to Wix's default, send default: true without a content object.

Authentication

You can only call this method when authenticated as a Wix app or Wix user identity.

Permissions
Manage Ads.txt
Learn more about app permissions.
Endpoint
PATCH
https://www.wixapis.com/promote-seo-robots-server/v2/ads

Body Params
adsTxtAdsTxt

Submitted content object will be appended to the existing Ads.txt file. To reset Ads.txt to Wix's default, submit default:true without a content object.

Response Object
adsTxtAdsTxt

Appended Ads.txt file.

Append Ads.txt Example
Request
cURL
curl PATCH https://www.wixapis.com/promote-seo-txt-file-server/v2/ads \ -H 'Content-Type: application/json;charset=UTF-8' \ -H 'Authorization: <AUTH>' \ -d '{"adsTxt": {"content": "google.com, pub-0000000000000001, DIRECT, f08c47fec0942fa0", "subdomain": "www"}}'
Response
JSON
{ "adsTxt": { "content": "google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0\ngoogle.com, pub-0000000000000001, DIRECT, f08c47fec0942fa0", "default": false, "subdomain": "www" } }
Errors
428Failed Precondition

There is 1 error with this status code:

See the entire list and learn more about Wix errors.

Event TriggersThis method triggers the following events:
Did this help?

Ads Txt Updated


Permissions
Manage Ads.txt
Learn more about app permissions.
Event BodyEvent Body Event data is received as a JSON Web Token (JWT). It may be delayed. Be sure to verify the data was sent by Wix.
Event Data
idstring

Unique event ID. Allows clients to ignore duplicate webhooks.


entityFqdnstring

Fully qualified domain name of the entity associated with the event. Expected wix.promote.marketing.ads_txt.


slugstring

Event name. Expected updated.


entityIdstring

ID of the entity associated with the event.


eventTimestringformat date-time

Event timestamp.


triggeredByAnonymizeRequestboolean

Whether the event was triggered as a result of a privacy regulation application (for example, GDPR).


originatedFromstring

If present, indicates the action that triggered the event.


updatedEventUpdatedEvent

Event information.

Event Body

The data payload will include the following as an encoded JWT:

JSON
{ "data": { "eventType": "wix.promote.marketing.ads_txt_updated", "instanceId": "<app-instance-id>", "data": "<stringified-JSON>", // The identity field is sent as a stringified JSON "identity": { "identityType": "<identityType>", // ANONYMOUS_VISITOR, MEMBER, WIX_USER, APP "anonymousVisitorId": "<anonymousVisitorId>", // in case of ANONYMOUS_VISITOR "memberId": "<memberId>", // in case of MEMBER "wixUserId": "<wixUserId>", // in case of WIX_USER "appId": "<appId>" // in case of APP } } }

AdsTxtUpdated
JSON
{ "content": "test", "default": false, "subdomain": "www" }
Did this help?