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

# Response Codes

> Understanding TheBridge API response codes

# Response Codes

TheBridge API uses a variety of response codes to indicate the status of your requests. Understanding these codes is crucial for effective error handling and troubleshooting in your integration.

## Response Code Structure

Each response includes two key elements:

* `response_code`: A numeric code indicating the status of the request.
* `response_message`: A human-readable description of the status.

## List of Response Codes

<ResponseField name="Success Codes" type="Success">
  <Expandable title="Success Codes">
    <ResponseField name="202" type="string">
      Request successfully received for processing. (Means: Mobile money payment has been initiated. You should receive a prompt to complete the payment.)
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="Error Codes" type="Error">
  <Expandable title="Authentication Errors">
    <ResponseField name="011" type="string">
      You provided wrong authentication keys in the request. Please check and try again.
    </ResponseField>

    <ResponseField name="100" type="string">
      You are not allowed to use this service
    </ResponseField>

    <ResponseField name="101" type="string">
      No Authorization header information
    </ResponseField>

    <ResponseField name="102" type="string">
      Invalid tokens received
    </ResponseField>

    <ResponseField name="103" type="string">
      Invalid signature
    </ResponseField>

    <ResponseField name="062" type="string">
      Undefined transaction type in request
    </ResponseField>

    <ResponseField name="064" type="string">
      You are unauthorized to perform this action.
    </ResponseField>
  </Expandable>

  <Expandable title="Request Format Errors">
    <ResponseField name="004" type="string">
      Invalid request format
    </ResponseField>

    <ResponseField name="022" type="string">
      Invalid JSON request format
    </ResponseField>
  </Expandable>

  <Expandable title="Missing or Invalid Parameters">
    <ResponseField name="002" type="string">
      Missing or Invalid service ID in request.
    </ResponseField>

    <ResponseField name="003" type="string">
      Invalid service ID request format.
    </ResponseField>

    <ResponseField name="005" type="string">
      Missing or invalid External Transaction ID in request
    </ResponseField>

    <ResponseField name="006" type="string">
      Missing or invalid Callback URL in request
    </ResponseField>

    <ResponseField name="007" type="string">
      Missing or invalid Currency Code in request
    </ResponseField>

    <ResponseField name="008" type="string">
      Missing or invalid Currency Value in request
    </ResponseField>

    <ResponseField name="207" type="string">
      Transaction network missing in request
    </ResponseField>

    <ResponseField name="210" type="string">
      Missing payment medium in request
    </ResponseField>

    <ResponseField name="220" type="string">
      Invalid phone number
    </ResponseField>

    <ResponseField name="238" type="string">
      Invalid amount specified in request
    </ResponseField>

    <ResponseField name="239" type="string">
      Missing request amount
    </ResponseField>

    <ResponseField name="245" type="string">
      Missing or invalid transaction or Order ID in request.
    </ResponseField>

    <ResponseField name="254" type="string">
      Amount cannot be zero
    </ResponseField>
  </Expandable>

  <Expandable title="Time-related Errors">
    <ResponseField name="017" type="string">
      Request expired.
    </ResponseField>

    <ResponseField name="018" type="string">
      Missing timestamp in request
    </ResponseField>

    <ResponseField name="023" type="string">
      Invalid timestamp in request
    </ResponseField>
  </Expandable>

  <Expandable title="Transaction-related Status">
    <ResponseField name="219" type="string">
      Duplicate transaction request
    </ResponseField>

    <ResponseField name="501" type="string">
      Transaction has failed.
    </ResponseField>

    <ResponseField name="502" type="string">
      Transaction is pending.
    </ResponseField>

    <ResponseField name="202" type="string">
      Request successfully received for processing
    </ResponseField>

    <ResponseField name="228" type="string">
      Request could not be processed successfully
    </ResponseField>

    <ResponseField name="027" type="string">
      No record found
    </ResponseField>
  </Expandable>
</ResponseField>

## Handling Response Codes

When integrating with TheBridge API, always check the `response_code` in your API responses. Here's a general approach to handling these codes:

1. **Success (500)**: Proceed with your application logic for successful transactions.
2. **Authentication Errors (011)**: Review your API credentials and ensure they are correctly implemented.
3. **Request Format Errors (004, 022)**: Check your request structure and ensure it matches the API specifications.
4. **Missing or Invalid Parameters**: Review the specific parameter mentioned in the error message and correct it in your request.
5. **Time-related Errors**: Ensure your system clock is synchronized and that requests are sent in a timely manner.
6. **Transaction Status**: Handle accordingly based on whether the transaction is duplicate, failed, or pending.

Remember to always provide clear feedback to your users based on these response codes, and implement appropriate error handling in your application.
