Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.nixflex.com/llms.txt

Use this file to discover all available pages before exploring further.

All Nixflex API errors follow a consistent shape so you can handle them programmatically.

Error response format

{
  "error": {
    "type": "invalid_request",
    "code": "invalid_phone_format",
    "message": "Invalid phone number format. Use international format like +447446466847.",
    "doc_url": "https://docs.nixflex.com/reference/errors#invalid_phone_format",
    "details": {}
  }
}
FieldUse it for
typeBroad category — for routing your error handler
codeSpecific reason — for programmatic logic
messageHuman-readable explanation — safe to display to users
doc_urlLink to this page for more context
detailsExtra context (which field failed, what was expected)
Always check code for branching logic, not message (messages may be reworded).

Error types

TypeHTTP statusMeaning
authentication_error401Missing or invalid API key
permission_error403Authenticated but not allowed to access this resource
invalid_request400Malformed or missing parameters
not_found404The resource doesn’t exist or doesn’t belong to you
conflict409The action conflicts with current state
rate_limit_error429Too many requests; back off and retry
provider_error502An upstream provider (Twilio, Deepgram, etc.) failed
server_error500Something went wrong on our end

Common error codes

Authentication

CodeCauseFix
invalid_api_keyWrong, missing, or revoked keyCheck the Authorization header format and key validity
key_secret_requiredHeader missing the secret halfFormat should be Bearer key_id:key_secret

Agents

CodeCauseFix
agent_not_foundagent_id doesn’t existVerify the ID from GET /v1/agents
agent_not_ownedAgent exists but belongs to another accountUse one of your own agents
prompt_too_longSystem prompt exceeds limitTrim to under ~10,000 chars
invalid_voice_idVoice ID not recognisedUse a voice from the supported list

Phone numbers

CodeCauseFix
invalid_phone_formatNumber not in E.164 (+CC...)Format as +447446466847
invalid_twilio_sidSID doesn’t match AC + 32 hex charsGet the right SID from Twilio console
number_not_in_twilioNumber doesn’t exist in the Twilio account givenConfirm the number is in that account
twilio_invalid_credentialsTwilio SID + token combo rejectedVerify token isn’t expired or wrong
twilio_auth_failedTwilio returned error code 20003Same as above — wrong creds
number_already_importedNumber is already on a different agentDelete first, then re-import

Calls

CodeCauseFix
call_not_foundcall_id doesn’t exist or isn’t yoursVerify with GET /v1/calls
outbound_failedTwilio couldn’t place the callCheck details.twilio_error
from_number_not_ownedThe from_number isn’t imported to your accountImport it first
agent_no_phoneOutbound call but agent has no phone numbers attachedAttach a number to the agent

SMS

CodeCauseFix
sms_not_supported_in_regionUS number without A2P 10DLCRegister A2P with Twilio
message_too_longBody over 1600 charsSplit or shorten
recipient_unsubscribedRecipient previously sent STOPThey opted out; can’t message them

Rate limits

CodeCauseFix
rate_limit_exceededToo many API requestsSee rate limits; back off
concurrent_call_limitToo many simultaneous callsReduce campaign concurrency or contact us

Handling errors in code

A clean handler pattern:
async function callNixflex(path, options) {
  const res = await fetch(`https://api.nixflex.com${path}`, {
    ...options,
    headers: {
      'Authorization': `Bearer ${process.env.NIXFLEX_KEY_ID}:${process.env.NIXFLEX_KEY_SECRET}`,
      'Content-Type': 'application/json',
      ...options.headers,
    },
  });

  if (!res.ok) {
    const { error } = await res.json();

    switch (error.code) {
      case 'rate_limit_exceeded':
        // Wait then retry
        await sleep(2000);
        return callNixflex(path, options);

      case 'twilio_invalid_credentials':
      case 'number_not_in_twilio':
        // Show user-facing error
        throw new Error(`Twilio setup issue: ${error.message}`);

      case 'agent_not_owned':
      case 'invalid_api_key':
        // Auth issue — log and alert
        await alertOps(error);
        throw new Error('Auth failed');

      default:
        throw new Error(`Nixflex error: ${error.message}`);
    }
  }

  return res.json();
}

When to contact support

If you get a server_error or repeated provider_error for the same operation, something’s wrong on our end. Email support@nixflex.com with:
  • The call_id or message_id if applicable
  • The full error response (type, code, details)
  • Approximate timestamp
  • What you were trying to do