Authenticate your API calls before making API calls. The Invoice API uses JSON web tokens (JWT) for authentication. To generate a token for accessing the API, you need to make use of your Invoice e-mail address and password. All API calls requires a token for authentication.

Your token is the value of "token" in the json response. This must be included as an Authorization header in all subsequent requests.

URL: https://api.getinvoice.co/v1/authenticate

Request POST
$request = [
    'headers' => ['Content-Type: application/json'],    
    'url' => 'https://api.getinvoice.co/v1/authenticate',
    'params' => json_encode([
        'email'     => 'test@invoice.ng',
        'password'     => 'abx123xyz'
    ])
];
                                        
Query Parameters
Parameter Type Description
email string The registered email address of the user (required)
password string The registered password of the user (required)
Example authentication in HttpClient
$request = [
    'headers' => ['Content-Type: application/json'],    
    'url' => 'https://api.getinvoice.co/v1/authenticate',
    'params' => json_encode([
        'email'     => 'test@invoice.ng',
        'password'     => 'abx123xyz'
    ])
];
                                        
Response HTTP/1.1 200 OK
{
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjYzLCJpc3MiOiJodHRwczpcL1wvYXBpLmludm9pY2UubmdcL2F1dGhlbnRpY2F0ZSIsImlhdCI6MTQ5Nzg3NDU4NCwiZXhwIjoxNDk3ODgxNzg0LCJuYmYiOjE0OTc4NzQ1ODQsImp0aSI6InVOajVIN05VbmtkZm1GN2MifQ.lqzV8n71xBtkTqi4jjup4_lpEEn-RYsdLSL0S_EGots",
    "type": "bearer",
    "expiry": 1497881784
}
                                        
Authorization Header
Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEsImlzcyI6Imh0dHBzOlwvXC9....

An access token will expire in the time defined by expiry in the response from Authentication. If a token has expired you will need to refresh it using the current refresh_token to generate a new access token.

Once this is done the previous access token is invalidated.

Http Request

GET https://api.getinvoice.co/v1/token/refresh

Response HTTP/1.1 200 OK
{
    "refresh_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjYzLCJpc3MiOiJodHRwczpcL1wvYXBpLmludm9pY2UubmdcL2F1dGhlbnRpY2F0ZSIsImlhdCI6MTQ5Nzg3NDU4NCwiZXhwIjoxNDk3ODgxNzg0LCJuYmYiOjE0OTc4NzQ1ODQsImp0aSI6InVOajVIN05VbmtkZm1GN2MifQ.lqzV8n71xBtkTqi4jjup4_lpEEn-RYsdLSL0S_EGots",
    "type": "bearer",
    "expiry": 1497881784
}
                                        

Copyright © InvoiceApp Technologies. All Rights Reserved.