Skip to content

API Credential Issues

Troubleshooting problems with third-party API keys and credentials used by UniSync.


Invalid API Key

Symptoms: API calls fail with 401 Unauthorized or Invalid API Key errors. Content generation or keyword research does not work.

Cause: The API key is incorrect, belongs to the wrong provider, or has been revoked.

Resolution:

  1. Go to API Management in UniSync and check which keys are configured.
  2. Verify you are using the right key for the right provider:
    • Text generation: OpenAI API key (starts with sk-) or compatible provider key.
    • Search/Keywords: Google Ads API credentials.
    • Image generation: Provider-specific key (DALL-E uses the OpenAI key; others have separate keys).
  3. Test the key outside UniSync:
    bash
    # OpenAI
    curl https://api.openai.com/v1/models \
      -H "Authorization: Bearer sk-your-key-here"
    
    # A valid key returns a JSON list of models.
    # An invalid key returns a 401 error.
  4. If the key was recently rotated or regenerated, update it in UniSync -- old keys stop working immediately.
  5. Check for invisible characters: copy the key from the provider dashboard fresh rather than from a text file that may have added whitespace or line breaks.

Rate Limit Exceeded

Symptoms: Requests fail with 429 Too Many Requests. Content generation works sometimes but fails under load. Logs show "rate limit" messages.

Cause: You are sending more requests per minute than the API provider allows for your plan tier.

Resolution:

  1. UniSync handles rate limits automatically with exponential backoff and retry. In most cases, the operation will succeed after a short delay.
  2. If rate limits are persistent:
    • Check your usage on the provider dashboard.
    • Consider upgrading your API plan for higher rate limits.
    • Reduce the number of agents running simultaneously.
    • Increase the interval between agent runs.
  3. Provider rate limit dashboards:
  4. If running many agents in parallel, stagger their start times to avoid bursts.

Quota Exhausted

Symptoms: API calls fail with messages about exceeded quota or insufficient funds. Everything was working earlier in the month.

Cause: You have hit the monthly spending limit or prepaid credit balance on your API account.

Resolution:

  1. Check your billing status:
  2. Add funds or increase limits:
    • OpenAI: Add a payment method or increase your monthly limit in billing settings.
    • Google Ads: Check your developer account budget.
  3. Review spending with Token Analytics: UniSync tracks token usage per agent and per environment. Use the Token Analytics dashboard to see which agents are consuming the most tokens.
  4. Prevent future exhaustion:
    • Set up billing alerts on the provider's dashboard.
    • Use UniSync's monthly budget settings in Token Analytics to cap spending.
    • Use smaller/cheaper models for classification and keyword tasks (see Token Limits).

Provider Service Outage

Symptoms: All API calls fail simultaneously. Other UniSync features (UI, database) work fine. The provider's status page shows an incident.

Cause: The API provider is experiencing downtime or degraded performance.

Resolution:

  1. Check provider status pages:
  2. Wait and retry. Provider outages are typically resolved within minutes to hours.
  3. UniSync will automatically retry failed requests. Agents that fail during an outage can be re-run once service is restored.
  4. If the outage is prolonged, consider:
    • Pausing autopilot agents to avoid accumulating failed runs.
    • Checking social media or developer forums for outage reports if the status page has not been updated.

Symptoms: Keyword research or search volume features fail. Errors mention "developer token", "OAuth", or "Google Ads API access".

Cause: Google Ads API requires a multi-step setup: a developer token, OAuth 2.0 credentials, and a linked Google Ads account.

Resolution:

  1. Developer token: Required for all Google Ads API access.
    • Log in to your Google Ads account.
    • Go to Tools & Settings > API Center.
    • Apply for a developer token if you do not have one.
    • Note: New tokens start with "Test account" access (limited). Apply for "Basic" access for production use.
  2. OAuth 2.0 credentials:
    • Create credentials in Google Cloud Console.
    • Enable the "Google Ads API" in your Google Cloud project.
    • Generate an OAuth 2.0 Client ID (type: Web application or Desktop).
    • Complete the OAuth consent screen setup.
  3. Refresh token: After OAuth setup, you need a refresh token:
    • Use the OAuth flow to authorize your Google Ads account.
    • Store the refresh token in UniSync's API Management.
  4. Link accounts: The Google Cloud project must be linked to the Google Ads account that owns the developer token.
  5. Test access:

Credential Storage

Best practices for managing API credentials in UniSync:

  • All credentials are stored in the PostgreSQL database, associated with your user account.
  • Credentials are never exposed in API responses after initial creation (masked display).
  • Each publish environment can have its own set of credentials.
  • When rotating keys, update the credential in UniSync immediately after generating the new key on the provider side.
  • If you suspect a key has been compromised, revoke it on the provider's dashboard first, then update UniSync.

UniSync Documentation