> ## Documentation Index
> Fetch the complete documentation index at: https://docs.markifact.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Custom Pinterest App

> Create your own Pinterest app and mint a refresh token so Pinterest Ads and Pinterest organic connections in Markifact run under your app (white-label).

Both Pinterest connections in Markifact (Pinterest Ads and Pinterest organic) can run under **your own Pinterest app** instead of Markifact's. You create the app once, mint a refresh token with the scopes for the channels you use, and paste three values into Markifact.

<Note>
  Custom app connections are available on the **Team** plan. See [White-label Connections](/core-concepts/white-label-connections) for the overview.
</Note>

***

## What Every Pinterest Channel Needs

| Value             | Where it comes from                                                                                                  |
| :---------------- | :------------------------------------------------------------------------------------------------------------------- |
| **App ID**        | Your app's page in the [Pinterest developer portal](https://developers.pinterest.com/apps/)                          |
| **App Secret**    | The same page                                                                                                        |
| **Refresh Token** | Minted against that app with the channel's scopes, by the Pinterest user who has access to the ad accounts or boards |

Pinterest access tokens expire after 30 days; Markifact refreshes them with your app ID and secret on every run. Refresh tokens last one year, after which you mint a new one and add the connection again with the same name.

<Note>
  **Already have your own authorization flow?** If your systems already hold a refresh token issued by your app with the scopes below, skip to the channel page and paste it.
</Note>

***

## Scopes per Channel

Request the scopes for every channel you plan to connect. One token can serve both.

| Channel           | Scopes                                                                                                                                                               | Setup page                                                                |
| :---------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------ |
| Pinterest Ads     | `ads:read`, `ads:write`, `user_accounts:read`, plus `pins:read`, `pins:write`, `boards:read`, `boards:write` for pin-based ads                                       | [Custom Pinterest Ads App](/nodes/pinterest_ads/pinterest_ads_custom_app) |
| Pinterest organic | `pins:read`, `pins:write`, `pins:read_secret`, `pins:write_secret`, `boards:read`, `boards:write`, `boards:read_secret`, `boards:write_secret`, `user_accounts:read` | [Custom Pinterest App](/nodes/pinterest/pinterest_custom_app)             |

***

## Setting Up Your Pinterest App

<Steps>
  <Step title="Create the App">
    1. Go to the [Pinterest developer portal](https://developers.pinterest.com/apps/) and click **Create app**
    2. Enter the app name and description. This is the branding users see when they authorize
    3. Under **Redirect URIs**, add a URL you control (for example `https://www.youragency.com/pinterest-callback`). Pinterest appends the auth code to this URL after authorization; the page does not need to do anything
    4. Copy the **App ID** and **App secret**
  </Step>

  <Step title="Request Standard Access">
    New apps start with **trial access**, which is rate limited and only works for the accounts that own the app. Request **standard access** in the portal and wait for Pinterest's approval before connecting client accounts. Agencies that already run their own integrations will have this in place.
  </Step>

  <Step title="Authorize and Get the Auth Code">
    1. Open the following URL in a browser, replacing the app ID, redirect URI and scopes (comma separated) for your channel:

    ```bash theme={"dark"}
    https://www.pinterest.com/oauth/?client_id=YOUR_APP_ID&redirect_uri=https%3A%2F%2Fwww.youragency.com%2Fpinterest-callback&response_type=code&scope=ads:read,ads:write,user_accounts:read,pins:read,pins:write,boards:read,boards:write&state=markifact
    ```

    2. Sign in as the Pinterest user who has access to the ad accounts or boards you want to work with and click **Give access**
    3. Pinterest redirects to your URL with `code=...` in the query string. Copy the value. Auth codes expire quickly and can be exchanged once, so do the next step right away
  </Step>

  <Step title="Exchange the Auth Code for a Refresh Token">
    Run this request, replacing the values (the redirect URI must match the one used above exactly):

    ```bash theme={"dark"}
    curl -X POST "https://api.pinterest.com/v5/oauth/token" \
      -u "YOUR_APP_ID:YOUR_APP_SECRET" \
      -H "Content-Type: application/x-www-form-urlencoded" \
      -d "grant_type=authorization_code" \
      -d "code=THE_AUTH_CODE" \
      -d "redirect_uri=https://www.youragency.com/pinterest-callback"
    ```

    The response contains `refresh_token`. Copy it.

    > **Important:** Keep this token secure. Anyone holding it, together with your app ID and secret, can act on everything the Pinterest user can access within the granted scopes.
  </Step>

  <Step title="Connect in Markifact">
    Open the channel's setup page from the table above, or go straight to [Connections](https://app.markifact.com/connections), click **Connect** on the channel, select the **Custom App (White-label)** tab, name the connection and paste the three values. Markifact refreshes the token once with your app and makes one read call before saving anything.
  </Step>
</Steps>

***

## Rotating or Replacing the Token

Add the connection again with the **same connection name** and the new refresh token. Markifact replaces the stored credentials in place, so workflows and agents bound to the connection keep working.

***

## Troubleshooting

<Accordion title="Pinterest rejected the credentials (Authentication failed)">
  Pinterest answers the same way for a wrong app ID or secret and for a refresh token that was issued by a different app, revoked, or expired (one year). Check the App ID and App secret on your app's page, then mint a new refresh token with that app and add the connection again with the same name.
</Accordion>

<Accordion title="Pinterest refused access (403)">
  The token is missing a scope for the channel, or your app is still on trial access and the account is not one that owns the app. Check the scopes and the access level in the developer portal, then mint a new token.
</Accordion>

***

## Related

<CardGroup cols={2}>
  <Card title="White-label Connections" icon="tag" href="/core-concepts/white-label-connections">
    Overview of custom app connections across channels
  </Card>

  <Card title="Connections" icon="plug" href="/core-concepts/connections">
    How connections, sharing, and privacy work
  </Card>
</CardGroup>
