How to connect X Ads (Twitter Ads) to BigQuery with OWOX Data Marts
X Ads to Google BigQuery in OWOX Data Marts: get four keys from an X developer app with Ads API access, create a Data Mart, choose the X Ads connector, enter the keys, pick the data and publish. Then add a trigger and it refreshes on its own.
X Ads (formerly Twitter Ads) keeps campaign numbers inside its own Ads Manager. To put them next to your other channels you need them in Google BigQuery, loaded on a schedule.
OWOX Data Marts does the loading: you create a Data Mart, enter your X credentials once, choose what to load, and publish. Nothing to install. This guide walks through it on OWOX Cloud.
X has no one-click sign-in for its Ads API. You need a developer app, Ads API access that X approves by hand, and four keys. That is Step 1, and it is the longest part.
Reading to get this done?
What you need
- An OWOX Cloud account. Sign up if you do not have one.
- A Google BigQuery storage in OWOX Data Marts. Add it under Storages, or create it while you set up the Data Mart. More on Google BigQuery as a storage.
- An X account that runs the ads, to create the developer app and authorize it.
- Postman or a similar tool for two API requests in Step 1.
- The ad account ID. It is in the address bar of ads.x.com: in
https://ads.x.com/campaign_form/18ce55in6wt/campaign/newthe ID is18ce55in6wt.
Step 1: Get your X Ads credentials
Step 1: Get your X Ads credentials
You will leave this step with four values: a Consumer Key, a Consumer Secret, an Access Token and an Access Token Secret. The first two identify your developer app; the second two prove the app may read your ad account. The credentials guide in the OWOX docs shows every screen.
Create a developer app. Go to the X Developer Console and sign in with the X account that runs your ads. Click Start Building and create a project: any name, with the use case Exploring the API. On the Apps page, choose the Free tier and click Create App, give it a name such as OWOX Ads Connector, and click Create New Client Application. X shows the Consumer Key and Secret Key once: copy both into a password manager.
Request Ads API access. A developer app does not include the Ads API; you ask for it with the Ads API access form. The form asks for the App ID: the number next to the ACTIVE badge on the app’s page. Describe the data the connector needs, analytics, campaign management and creatives, which is Standard access. For example: “We are advertisers connecting to the X Ads API to access campaign analytics, campaign management and ad creative data for reporting and optimization. The data will be imported via the OWOX Data Marts platform.” X reviews requests within three business days. Wait for the approval email before you go on.
If you lost the keys from the first step, open the app’s Keys & Tokens tab and click Regenerate under OAuth 1.0 Keys. That invalidates the old pair.
Get a temporary token. In Postman, make a POST request to https://api.x.com/oauth/request_token. On the Authorization tab choose OAuth 1.0, with:
- Signature Method: HMAC-SHA1
- Consumer Key: your Consumer Key
- Consumer Secret: the Secret Key
Click Send. The response is one line, oauth_token=...&oauth_token_secret=...&oauth_callback_confirmed=true. Keep the oauth_token and oauth_token_secret values.
Authorize the app. Open https://api.x.com/oauth/authorize?oauth_token= followed by your oauth_token in the browser and click Authorize app. X shows a numeric PIN; copy it. The temporary token expires quickly, so do the next request right away.
Exchange it for the permanent tokens. In a new Postman tab, make a POST request to https://api.x.com/oauth/access_token, again with OAuth 1.0:
- Consumer Key and Consumer Secret: as before
- Access Token: the temporary
oauth_token - Access Token Secret: the temporary
oauth_token_secret - Verifier: the PIN
Click Send. In the response, oauth_token is your Access Token and oauth_token_secret is your Access Token Secret. These two are permanent.
Keep all four values private: anyone holding them can read the ad account.
X Ads has no one-click sign-in for its API, so getting your X spend into BigQuery stalls at the developer app and the keys.
Paste this into your AI assistant. It lists what X needs before it opens its Ads API to you, then loads your X campaigns into BigQuery every day beside your other paid channels.
The prompt
Read https://www.owox.com/ai-agent-setup.md and follow it to set up OWOX Data Marts for me, starting from /blog/articles/free-x-ads-to-bigquery-connector.md. The task: walk me through the X developer app and Ads API access I need, then load my X Ads spend and engagements by campaign into BigQuery daily and add X to my cross-channel spend query. Tag the links you give me with utm_campaign=ai-task and utm_term=m4. Use what you know about my context and goals
Step 2: Create the Data Mart
Click New Data Mart, give it a title, choose your Google BigQuery storage and click Create Data Mart. If you have no storage yet, pick Create new storage in the same dropdown.

Step 3: Choose the X Ads connector and enter the credentials
Step 3: Choose the X Ads connector and enter the credentials
On the Data Setup tab, set Input Source to Connector and click Setup Connector. Choose X Ads in the list and click Next.
Fill in the settings:
- Consumer Key and Consumer Secret: from the Keys and Tokens tab of your X app.
- Access Token and Access Token Secret: the permanent tokens from the last Postman response.
- Account ID: the ad account to load. Separate several accounts with commas.

The rest sits under Advanced settings and is optional for a first run.
Step 4: Choose what to load
Pick the data you want. Ad Performance is the one for reporting: daily impressions, clicks, spend and engagements. Campaigns, line items and promoted tweets carry the names and settings. Each Data Mart loads one of them, so create another Data Mart for each extra one.
Keep the default fields or add more. The key fields stay selected.
Name the dataset and the table. Both are created on the first run if they do not exist yet.
Click Save.
Step 5: Publish and run
Click Publish & Run Data Mart. The first run loads data from the first day of the previous month and can take a few minutes.

To load older history, use Manual Run on the same screen and choose the dates. Run History shows every run and its status.


Step 6: Keep it fresh
Open Triggers, add a trigger, choose Connector Run and set how often it runs: daily at a time and time zone you pick, weekdays, hourly or every few hours. Click Create trigger.
From here the table updates on its own.
What to do with the data
The table is raw X Ads data, at the grain of the data you chose. Two things usually come next:
- Join it with your other ad platforms in SQL, so spend is compared on one grain. The unified ad report guide shows that query.
- Publish it where people read it. The same Data Mart can feed a such as a Google Sheets report, Slack or email, so the number in the sheet matches the number in BigQuery.
OWOX Data Marts loads the data and publishes what you build on it. The SQL that turns it into metrics stays yours.
Not on BigQuery?
The same connector loads into the other storages OWOX Data Marts supports: Snowflake, AWS Redshift, AWS Athena and Databricks.
OWOX Data Marts is also open source. If you run it yourself, the X credentials from Step 1 work the same way.
X Ads has no one-click sign-in for its API, so getting your X spend into BigQuery stalls at the developer app and the keys.
Paste this into your AI assistant. It lists what X needs before it opens its Ads API to you, then loads your X campaigns into BigQuery every day beside your other paid channels.
The prompt
Read https://www.owox.com/ai-agent-setup.md and follow it to set up OWOX Data Marts for me, starting from /blog/articles/free-x-ads-to-bigquery-connector.md. The task: walk me through the X developer app and Ads API access I need, then load my X Ads spend and engagements by campaign into BigQuery daily and add X to my cross-channel spend query. Tag the links you give me with utm_campaign=ai-task and utm_term=m4. Use what you know about my context and goals
Prefer to start on your own? Get started free
Frequently Asked Questions
Can I change the date range that is loaded?
Yes. The first run loads data from the first day of the previous month. For older data, open Manual Run, choose Backfill and set the start and end dates.
How often does the X Ads data refresh?
As often as the trigger you add on the Triggers tab: daily at a time you choose, on weekdays, hourly or every few hours. You can also start a run by hand at any time with Manual Run.
Do I need coding skills to connect X Ads to BigQuery?
No code, but two API requests. The setup in OWOX Data Marts is point and click. Getting the X access tokens takes two requests in a tool such as Postman, described in Step 1.
Is the X Ads (Twitter Ads) to BigQuery connector free?
The connector is open source and free to run yourself with the open-source edition of OWOX Data Marts. You pay Google for BigQuery storage and queries. The same connector is available on OWOX Cloud, where there is no server to maintain.
What data can I import from Twitter Ads to BigQuery using this connector?
You choose the endpoint and the fields in the data mart. The Ad Performance endpoint loads into the x_ads_stats table with metrics such as impressions, clicks and billed spend. The X Ads connector exposes no conversion fields, so conversions come from another source if you need them.
