Home
Home
  1. Home
  • Getting started
  • Authentication
  • Webhooks
  • Embeddable Widgets
    • Overview
    • Document Upload Widget
      • UI/UX Best Practices
  • Guides
    • Verifying a new business
    • Verifying bank accounts
    • Supported document types
  • API Reference
    • Submissions
      • Reports
        • List available report templates
        • Download a report
      • Create new submission
      • Get submission
      • Update submission
      • Update submission status
      • Run business verification
      • Get submission checks
      • Delete submission
    • Documents
      • Public Documents API
        • List documents
        • Upload document
        • Get document
        • Delete document
      • List documents
      • Upload document for submission
      • Get document
      • Delete document
      • Download document file
      • Rerun validations
    • RPC Search
      • Get company with ID
      • Company RFC Lookup
      • Company Name Search
      • Download document
    • Utilities
      • Matcher
        • Run name matching
  1. Home

Authentication

To ensure secure communication between your application and the Niva API, all API requests must be authenticated using token-based authentication. Each request must include an authentication token in the request headers. This token is provided when you register and is unique to your account.

Obtaining an API Token#

To obtain an API token:
1
Register for an API Key
Login to the Niva portal and generate a new API token.
2
Receive Your Token
Once created, you can use that token to authenticate your API requests.

Sending Authenticated Requests#

To authenticate your API requests, include the apiKey header with the token in your HTTP request.

Header Format#

apiKey: YOUR_API_TOKEN

Example Request#

Here’s an example of how to include the authentication token in an HTTP request using curl:

Error Handling#

If the API token is missing or invalid, the API will return an error response with an appropriate status code.

Common Error Responses#

401 Unauthorized: This error occurs if the token is missing or invalid.
403 Forbidden: This error occurs if the token does not have the necessary permissions to access the requested resource.

Example Error Response#

{
  "error": "Unauthorized",
  "message": "Invalid or missing authentication token."
}

Best Practices#

Keep Your Token Secure: Do not expose your API token in public repositories, client-side code, or anywhere it might be accessed by unauthorized individuals.
Regenerate Tokens Periodically: Periodically regenerate your API tokens to minimize the risk of them being compromised.
Monitor API Usage: Regularly monitor your API usage and be alert for any unusual activity.

Conclusion#

Authenticating your API requests is essential for secure and authorized access to the Niva API. If you have any questions or need further assistance, please contact our support team at support@niva.co.
Previous
Getting started
Next
Webhooks