Manage subaccounts

Use our API to easily manage subaccounts: Create, delete, retrieve information and transfer credit. Ideal for anyone who wants to manage their account structure clearly and efficiently.


GET/api/subaccounts?action=read

List subaccounts

Query a list of all subaccounts of an account.

Parameters

  • Name
    id
    Type
    integer
    Optional
    Optional
    Description

    The ID of a subaccount. This only provides you with the data for a specific sub-account.

request

GET
/api/subaccounts
curl -G https://gateway.seven.io/api/subaccounts \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Accept: application/json"

Answer

[
  {
      "id": "1234567891",
      "username": null,
      "company": "Company 1",
      "balance": "36.8100",
      "total_usage": "0.3000",
      "auto_topup": {
          "threshold": "1",
          "amount": "5"
      },
      "contact": {
          "name": "John Doe",
          "email": "sms@acme-company1.com"
      }
  },
  {
      "id": "1234567892",
      "username": "push2app",
      "company": "Another Company",
      "balance": "120.4000",
      "total_usage": "0.0000",
      "auto_topup": {
          "threshold": null,
          "amount": null
      },
      "contact": {
          "name": "Donald Dummy",
          "email": "contact@another-acme-company.com"
      }
  },
  {
    "id": 12345
    // ...
  }
]

POST/api/subaccounts?action=create

Create subaccount

Create a subaccount via the API.

Parameters

  • Name
    name
    Type
    string
    Description

    Full first and last name of the account owner.

  • Name
    email
    Type
    string
    Description

    E-mail address of the account.

request

POST
/api/subaccounts?action=create
curl -G https://gateway.seven.io/api/subaccounts \
  -H "X-Api-Key: YOUR_API_KEY" \
  -d "name=John Doe" \
  -d "email=john.doe@acme-inc.com"

Response in case of success

{
  "success": true,
  "error": null,
  "subaccount": {
      "id": "123456789",
      "username": null,
      "company": null,
      "balance": 0,
      "total_usage": 0,
      "auto_topup": {
          "threshold": 0,
          "amount": 0
      },
      "contact": {
          "name": "John Doe",
          "email": "john.doe@acme-inc.com"
      }
  }
}

Response on error

{
  "success": false,
  "error": "Invalid request"
}

POST/api/subaccounts?action=update

Automatic credit transfer

With this API you can configure the automatic credit transfer for a subaccount. This can transfer credit from the main account to the subaccount when the balance falls below a defined threshold. To deactivate, simply set amount to 0.

Parameter

  • Name
    id
    Type
    integer
    Description

    The ID of the subaccount.

  • Name
    threshold
    Type
    float
    Description

    The credit threshold below which credit is to be transferred.

  • Name
    amount
    Type
    float
    Description

    The amount of credit to be sent from the main account to the sub-account if the balance falls below the threshold.

request

POST
/api/subaccounts?action=update
curl -G https://gateway.seven.io/api/subaccounts \
  -H "X-Api-Key: YOUR_API_KEY" \
  -d "id=49176123456789" \
  -d "threshold=100.0" \
  -d "amount=200.0"

Response in case of success

{
  "success": true,
  "error": null
}

POST/api/subaccounts?action=transfer_credits

Manual credit transfer

You can use this API to transfer credits from the main account to the subaccount once.

Parameters

  • Name
    id
    Type
    integer
    Description

    ID of the subaccount.

  • Name
    amount
    Type
    float
    Description

    Credit balance to be transferred.

request

POST
/api/subaccounts?action=update
curl -G https://gateway.seven.io/api/subaccounts \
  -H "X-Api-Key: YOUR_API_KEY" \
  -d "id=123456789" \
  -d "amount=250.0"

Answer

{
  "success": true,
  "error": null
}

POST/api/subaccounts?action=delete

Delete a subaccount

You can use this API to delete subaccount by its ID.

Parameters

  • Name
    id
    Type
    integer
    Description

    ID of the subaccount.

request

POST
/api/subaccounts?action=delete
curl -G https://gateway.seven.io/api/subaccounts?action=delete \
-H "X-Api-Key: YOUR_API_KEY" \
-d "id=123456789"

Answer

{
    "success": true,
    "error": null
}