Skip to content

Partner API Documentation v1.0


Introduction

We're excited to announce the finalization of the first version of our Partner API! As we continue developing more features for our partners, this document serves to formally present and document this new functionality.

Primary Features

This API is designed to streamline your customer onboarding process by allowing you to easily manage accounts and securely fetch credentials.

The core functionalities provided in this version are:

  1. Account Creation: Programmatically create new accounts on our system for your clients.
  2. Flexible Approval Notification: Receive a secure notification once an account has been approved internally.
  3. Secure Credential Fetching: Use a one-time token to instantly retrieve the necessary API keys and secrets for your client.

Contact and Access

For any questions, support, or to request access to the Partner API on any environment (Integration or Production), please use the dedicated contact information below.

DetailValue
Primary Contactpartners@aplyid.com
PurposeAccess requests, integration questions, and partnership-related support.
Secondary Contactsupport@aplyid.com
PurposeAPLYiD core product support, account questions, and non-partner related questions

Account Creation Workflow

We have implemented a simple yet secure, two-step sequence for account creation and credential retrieval:

Step 1: Account Request & Notification Setup

You send us a request containing your client's company name and a dedicated Notification URL. We will use this URL to inform you once the account has been approved internally.

Step 2: Approval and Credential Fetch

  1. Once internal paperwork is complete, we will send an Approval Notification to your provided URL. This notification will contain:
    • A One-Time Token.
    • The Credential Request URL.
  2. You submit the token to the Credential Request URL.
  3. Our system validates the token and responds with your client's unique API Key and API Secret for you to set up in your system.


Detailed Sequence & Technical Notes

Notes on Approval Notification Handling

The approval notification sent to your designated Notification URL is critical for completing the account setup. Please be aware of the following operational and implementation details:

Worker Retries and Success

  • The approval notification will be dispatched by one of our background workers.
  • This worker will retry sending the notification until it receives a successful HTTP response status code (e.g., 200 OK, 204 No Content) from your server.

Token and Credential Fetching Strategy

You have two main implementation options for handling the received notification:

  1. Immediate Fetch (Synchronous): Fetch the credentials instantly within the context of the notification request.
  2. Delayed Fetch (Asynchronous/Recommended): Save the one-time token and URL, then immediately send a successful response back to our worker. A separate, decoupled process (like a job queue) should then handle the credential fetching.

⚠️ Critical Implementation Warning (Timeouts)

If you choose the Immediate Fetch strategy:

  • Do not exceed a 30-second execution time. Our system will timeout any request exceeding this limit.
  • A timeout will cause our worker to treat the attempt as a failure and retry the notification, which may lead to redundant or conflicting operations on your system.

Finality of the Notification

  • Once our worker receives a successful response from your Notification URL, it will assume the token has been handled correctly.
  • There will be no further attempts to send the notification, and the one-time token will not be retrievable through any other means.
  • We strongly recommend being mindful around edge cases and error handling on your side to prevent the token from being lost or mishandled, avoiding this kind of dead-end scenario.

Detailed sequence

Acount creation sequece

Pre-requisites and Authentication

Partner Account Setup

To begin development, please ensure you have a partner account setup:

  • Action: Send us an email at partners@aplyid.com to initiate the partner account generation process.
  • Credentials: Once complete, we will communicate your Integration Environment API Keys for you to begin development and testing.

Authentication

The Partner API utilizes the same authentication model as our v4 API:

  • Model: Key-based authentication is handled identically to the v4 API. For a full understanding of the process, please consult: V4 Authentication.
  • Signature: Signature calculation and validation is not mandatory and is left to your discretion.


API Endpoint Reference

This section provides the technical details for the three core operations: creating an account, handling the approval notification, and fetching the credentials.

1. Creating an Account

This endpoint initiates the account creation process on our system.

DetailDescription
URLPOST /api/v4/companies
AuthenticationAply-API-Key header (Your Partner API Key)
NotesAccount creation is currently restricted to the company name. More parameters will be added in future versions.

Request Body

ParameterTypeRequiredDescription
companyobjectYesContainer for company details.
company.namestringYesThe name of your client's company.
notificationobjectYesWebhook configuration for approval notification.
notification.urlstringYesYour webhook endpoint URL. Must be HTTPS.
notification.headersobjectNoKey/value pairs of custom headers for us to include in the notification request.

Example Request:

json
{
  "company": {
    "name": "Test company"
  },
  "notification": {
    "url": "https://your-system.com/28c1da32-5c75-482f-ba7d-3ace70b979a5",
    "headers": {
      "Authorization": "Bearer a-bearer-token"
    }
  }
}

Successful Response

  • Status: 201 Created
  • Action: We recommend you save the returned company_id in your system for future reference.

Example Response:

json
{
  "company_id": 1234
}

2. Company Approval Notification (Webhook)

This is the request our background worker sends to the notification.url you provided once the account is approved by our support team.

DetailDescription
URLPOST {provided_url} (The URL you configured in the creation request)
AuthenticationIncludes any custom headers you provided (e.g., Authorization).
NotesYour system must return a successful HTTP status code (2xx) to prevent the notification from being retried.

Request Headers

HeaderExample ValueNotes
AuthorizationBearer a-bearer-tokenYour custom headers provided during account creation will be included here.

Request Body

ParameterTypeDescription
eventstringThe event name (always "company_approved").
company_idintegerThe ID of your newly created account.
credentialsobjectContainer for credential retrieval details.
credentials.urlstringThe exact URL to use for fetching the final API keys.
credentials.ottstringThe One-Time Token (OTT) required to authenticate the credential fetch request.

Example Request Body:

json
{
  "event": "company_approved",
  "company_id": 1234,
  "credentials": {
    "url": "https://integration.aplyid.com/api/v4/companies/1234/credentials",
    "ott": "TXgy4PfmpwA6tKBaxdN4sdAg"
  }
}

3. Fetching the Created Account Credentials

This endpoint is the final step, used to exchange the one-time token for the permanent API keys.

DetailDescription
URLPUT /api/v4/companies/{company_id}/credentials (Use the URL received in the notification)
HTTP MethodPUT
Request BodyNone
NotesThe OTT is invalidated immediately upon a successful response. Ensure robust error handling before responding to our worker.

Required Headers

The one-time token (ott) received in the notification is used in the Authorization header.

HeaderValue StructureDescription
Aply-API-Key(Your Partner API Key)Used for identifying the partner making the request.
AuthorizationToken {ott}The One-Time Token prefixed with Token and a space.

Successful Response

The response contains the permanent API credentials for the new client account.

Example Response:

json
{
  "api_key": "kCCCYzBZbcJL8S6Ln6MQKPSS",
  "api_secret": "UrrGaEV1w6JPd6aeYboPkM7SNuLVyVnR"
}

Action: These credentials should be stored securely in your system for your client to begin using our services. The one-time token is now invalid.