To generate your first successful API call, there are 3 important steps you need to accomplish. Follow the steps below to make a call and get real data from your accounts directly from the Shape API:
Generate a Shape API Auth Token
1. If you have not already, sign up for a Shape account.
2. Connect all of the advertising data sources to Shape that you wish to be able to access using the Shape API.
3. On the Shape dashboard, click the ADI tab in the left-side navigation menu
4. Click "API", then select API Dashboard from the dropdown
5. Click "Generate Auth Token"
6. Copy the auth token and store it in a safe place.
Write, Validate, and Test A Query Using the Forge
1. On the left-hand navigation, click "API," then select Query Builder from the dropdown menu.
2. At the bottom of the screen, where it says Query Variables, hover over the text. Drag the arrow that appears upwards. This is where you will enter variables.
3. Enter the auth_token you created in the Query Variables field next to "auth_token."
4. In Query Variables, you'll need to enter a code for the appropriate root object (or level at which you wish to pull data for).
If your root object is an account, your code would be code_account. A full list of available root objects can be found in Shape's API documentation. Some other "code_" examples are:
- code_company = Unique Company ID code generated by Shape
- code_account = Unique account ID generated by an ad platform
- code_campaign = Unique campaign ID generated by an ad platform
- code_adgroup or code_adset = Unique ad group or ad set ID generated by an ad platform
NOTE: You can find these codes in Shape or ad platforms (depending on the object/description). Make sure you enter your "auth_token" and "code_" surrounded by quotation marks on each side.
5. Enter your query into the section on the top left-hand side of the screen.
Here is an example query you can use to pull information and performance data for Budgets in Shape. Just make sure your auth_token and code_company are set appropriately.
6. Click the blue triangle at the top of the screen to run the query.
7. If your query is successful, data will appear in the middle grey box. Validate that this is the data you expected to see.
Generate an API Call
1. Now that you've made a successful Shape API Query, Shape will generate an API Call for you.
2. Click the View API Call button and the top of the screen.
3. Copy the API Call into your code as needed.