Welcome to the 4b42 API! Our API allows you to easily access your 4b42 account, get information about your products.
Overview
What should I know before starting?
Our API is continuously being developed and improved, but we are still trying to keep it as stable as possible. We try to only have changes that are backwards compatible: usually the changes are only additions, e.g. new resources are implemented or new properties are added to existing resources. Sometimes breaking changes cannot be avoided, e.g. when a new feature requires an incompatible change to the underlying data model, all those changes will be documented in the change log.
Methods
We use the following methods for our api:
Method | Type | Meaning |
---|---|---|
post | Create | Create a new instance |
get | Read | Query/list instances |
put | Update | Update a specific instance |
delete | Delete | Delete a specific instance |
Errors
When an error is encountered you will receive an HTTP status code along with a message and error code in the body of the response. The message is intended to give a user-friendly explanation of the error while the error codes are designed to be machine readable codes that applications can use to better understand the context of the error and react appropriately.
We use the following status codes for errors:
Status Codes
Status Code | Meaning |
---|---|
200 | OK - Request successful executed. |
400 | Bad request - The request contains errors. |
401 | Unauthorized - The authentication process failed, or the access token is not valid. |
403 | Forbidden - Access to this resource is restricted for the given caller. |
404 | Not Found - The specified resource could not be found. |
405 | Method Not Allowed - An invalid method was used to access a resource. |
406 | Not Acceptable - An unsupported format was requested. |
409 | Conflict - The requested operation on the resource cannot be made due the resource state. |
500 | Internal Server Error - There was a problem with the API host server. Try again later. |
503 | Service Unavailable - API is temporarily offline for maintenance. Try again later. |
Error Codes
Error Code | Meaning |
---|---|
AUTH_REQUIRED | Authentication required, please authenticate with apikey or username or password. |
CONNCECTION_FAILED | Connection to destination failed. |
CUSTOMER_CREATE_FAILED | Failed to create customer |
DNS_CONFIG_CREATE_FAILED | Failed to create dns configuration file. |
DNS_RECORD_ALREADY_EXIST | DNS Deamon reload failed! |
DNS_RELOAD_FAILED | DNS Deamon reload failed! |
DNS_SYNC_CREATE_FAILED | Failed to synchronize dns zonefile with slave servers. |
DNS_SYNC_DELETE_FAILED | Failed to synchronize dns zonefile with slave servers. |
DNS_ZONE_CREATE_FAILED | Failed to create dns zonefile, please contact our support. |
DNS_ZONE_DELETE_FAILED | Failed to delete dns zonefile. |
DNS_ZONE_REMOVE_FAILED | Failed to remove zonefile or signed zonefiles, please contact our support. |
DNS_ZONE_SIGN_FAILED | Failed to sign dns zonefile, dnssec not enabled. |
FEATURE_LIMIT_REACHED | You reached the limit of your product feature, please upgrade your product. |
FIELDS_EMPTY | All fields are empty, you must complete at least one field. |
GROUP_DOES_NOT_EXIST | Requested group does not exist, please verify your input. |
INVALID_AUTH | No apikey or username and password used in the header. Please verify your submitted headers. |
INVALID_APIKEY | The apikey sent in the header is wrong or inactive. Please make sure your apikey are correct. |
INVALID_CUSTOMER_NUMBER | The customer number is invalid (only numbers with 8 digits) or does not exist. |
INVALID_EMAIL | Invaild E-Mail Address specified, please verify submitted domain name. |
INVALID_FQDN | Invaild FQDN, please verify submitted domain name. |
INVALID_ID | Invaild ID, please verify submitted id. |
INVALID_PARAMETER | Parameter is empty or invalid. |
INVALID_PROTOCOL | Invalid protocol specified |
INVALID_URL | URL is incorret or was not found. |
INVALID_USER_OR_PASS | Username or password are incorrect, please verify your username and password. |
METHOD_RESTRICTED | You do not have permission to use this method using the token that you supplied. |
NETWORK_CREATE_FAILED | Failed to create network |
NETWORK_DELETE_FAILED | Failed to remove network from server, please try again later. |
ORDERING_NOT_ENABLED | In order to use our API for orders, please activate this function first via our website under access. |
PATH_RESTRICTED | You do not have permission to use this path using the token that you supplied. |
PERMISSION_DENIED | You doesn't have permission to access the desired data. |
RESELLER_REQUIRED | Permissson denied, you have to be a member of a reseller group. |
SQL_INSERT_ERROR | SQL Insert Query failed, please contact our support team |
SQL_UPDATE_ERROR | SQL Update Query failed. |
SQL_DELETE_ERROR | SQL Delete Query failed. |
UPN_ALREADY_EXIST | UPN-Suffix already exist. |
UPN_CONFIG_FAILED | UPN-Suffix configuration could not be saved, please contact our support team. |
USER_DOES_NOT_EXIST | Requested user does not exist, please verify your input. |
ZONE_ALREADY_IN_USE | This zonename is already in use. |
Changelog
2018-05-17 Group functions added
Functions added to manage (create,delete,lists and modify) groups of customers.
2018-03-09 Order over API must be granted
Now orders over the API can only made, if the option was enabled. This can be made on our website under access.
2018-03-08 Order Backup added
Added backup products to API.
2018-03-03 API Authentication
Updated authentication to support multible tokens with path and method permissions.
2018-03-02 API Error Codes defined
Defined API error codes for authentication, methods and paths.
2018-01-28 Tools Blacklist added
Created functions for domain and ip-address blacklist.
2017-11-24 Customer functions added
Added function GET to list all customers and details of a customer, added POST to create new customers and DELETE to remove customers
2017-04-14 API Authentication
Added API key authentication to our api.
2017-03-27 API Structure and Overview
Created the basic API structure, overview navication and content.
Authentication
All requests to the 4b42 API must be authenticated via API key. Include your secret API key in every request you send to the API with the 4b42-KEY HTTP header.
API Key
Once you have the 4b42 apie key, you can make the request to the api. To do this, add your api key to the request header.
get curl --header "4b42-KEY:hVQ8UPC3TZOrqWe9bM1nk4m27" https://api.securebit.ch/v1
To create a new API key for your project, visit the 4b42 website choose access, go to tokens, and create a new token.
manage/bind/record
GET Records
List all available Domain Name System Records from specific dns zone
GET /v1/manage/bind/record/{zone}
[ { "id": "5a11c4936ba6a", "dest": "10.48.42.61", "host": "@", "name": "@", "type": "A" }, { "id": "5a11c49b60bdc", "dest": "@", "host": "www", "name": "www", "type": "CNAME" } ]
Parameter
field | type | description | value |
---|---|---|---|
zone | String |
GET Record Types
List all available types for dns records
GET /v1/manage/bind/record/types
[ "A", "CNAME", "PTR", "MX", "AAAA", "TXT", "SRV", "TLSA" ]
GET Record
List details of specific dns record
GET /v1/manage/bind/record/{record}
{ "id": "5a11c49b60bdc", "created": "0000-00-00 00:00:00", "dest": "@", "host": "www", "pass": "", "port": "", "priority": "", "updated": "0000-00-00 00:00:00", "ttl": "300", "type": "CNAME", "valid": "yes", "weight": "" }
Parameter
field | type | description | value |
---|---|---|---|
record | String |
POST Record
Create new dns record
POST /v1/manage/bind/record/{zone}
"5aaa93479e3f1"
Parameter
field | type | description | value |
---|---|---|---|
zone | String | ||
dest | String | destination ip-address, hostname or text | |
host | String | source name of record, like @, www, mail | |
type | String | record type, like A, AAAA, CNAME, MX, SRV, TXT | |
passoptional | String | password for record, can be used for dyndns update | |
portoptional | Number | port number, like 443 used in SRV records | |
prioptional | Number | priority number, used in MX records | |
ttloptional | Number | override the default zone ttl | |
weightoptional | Number | set weight, used in SRV records |
PUT Record
Update dns record
PUT /v1/manage/bind/{productid}/record/{record}
{ "type": "A", "host": "mail", "pri": false, "weight": false, "port": false, "dest": "10.48.42.10", "ttl": false }
Parameter
field | type | description | value |
---|---|---|---|
productid | String | ||
record | String | ||
dest | String | destination ip-address, hostname or text | |
host | String | source name of record, like @, www, mail | |
type | String | record type, like A, AAAA, CNAME, MX, SRV, TXT | |
passoptional | String | password for record, can be used for dyndns update | |
portoptional | Number | port number, like 443 used in SRV records | |
prioptional | Number | priority number, used in MX records | |
ttloptional | Number | override the default zone ttl | |
weightoptional | Number | set weight, used in SRV records |
manage/bind/zone
GET Zones
List all available Domain Name System Zones
GET /v1/manage/bind/zone
[ { "created": "2020-02-02 02:02:02", "id": "4b42.com", "updated": "2020-11-11 11:11:11", "valid": "yes" }, { "created": "2000-01-01 00:00:00", "id": "4b42.com", "updated": "2000-02-02 00:00:00", "valid": "yes" } ]
GET Zone
List all available Domain Name System Zones
GET /v1/manage/bind/zone/{zone}
{ "id": "4b42.com", "created": "2018-03-03 03:03:03", "dnssec": "0", "expire": "3600000", "hostmaster": "hostmaster.4b42.com", "refresh": "86400", "retry": "7200", "serial": "2018030301", "ttl": "172800", "updated": "2018-03-03 03:03:03", "valid": "yes" }
Parameter
field | type | description | value |
---|---|---|---|
zone | String |
manage/internet/resources/asset
GET asset
List all autonomous system numbers verified
GET /v1/manage/internet/resources/asset/{productid}
[ 64496, 64511 ]
Parameter
field | type | description | value |
---|---|---|---|
productid | String |
POST asset
Add an autonomous system number to our AS-SET (verification requried!)
POST /v1/manage/internet/resources/asset/{productid}
{ "status": 200, "message": "Verification email send to [email protected]" }
Parameter
field | type | description | value |
---|---|---|---|
productid | String | ||
asn | Number | autonomous systen number | |
String | email address for verification (must match whois) |
manage/internet/tunnel
PUT tunnel
Update dns zone details, returns updated fields
PUT /v1/manage/internet/tunnel/{productid}
{ "endpoint": "198.51.100.51", "protocol": "sit" }
Parameter
field | type | description | value |
---|---|---|---|
productid | String | ||
protocol | String | tunnel protocol | |
endpoint | String | public ip of tunnel endpoint |