Skip to main content

Authorization

Once you have created your API key, you can now make authorized requests to the Strike API. To begin making an API request, add the API key to the request header’s authorization, in place of the <API_KEY>, and ensure the <ENVIRONMENT> is set to api.strike.me. Requests may also have required input fields that will need to be populated and in the correct format.

Below is an example request to create an invoice, with the correlationID, description, currency, and amount input fields already populated:

Example request:
curl -X 'POST' \
'https://<ENVIRONMENT>/v1/invoices' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <API_KEY> \
-H 'Content-Type: application/json' \
-d '{
"correlationId": "224bff37-021f-43e5-9b9c-390e3d834750",
"description": "Invoice for order 123",
"amount": {
"currency": "USD",
"amount": "150.00"
}
}

When the request is made, the Strike API will verify that the provided API key has the necessary scope for that endpoint.

Below is the response to the invoice creation request:

Example response:
{
"invoiceId": "6b91e56d-fce9-4eec-995f-1d08fe6ba380",
"amount": {
"amount": "150.00",
"currency": "USD"
},
"state": "UNPAID",
"created": "2021-11-12T20:08:45.98159+00:00",
"correlationId": "224bff37-021f-43e5-9b9c-390e3d834750",
"description": "Invoice for order 123",
"issuerId": "bf909224-3432-400b-895a-3010302f80f5",
"receiverId": "bf909224-3432-400b-895a-3010302f80f5"
}

The above response indicates that the request was valid and that an invoice has been created. The newly created invoice has been assigned an invoiceID, issuerID, receiverID, and is currently in the UNPAID state.

If an API request is made using an invalid API key, the Strike API will return an HTTP 401 “Unauthorized” response.

Below is the response to a request made with an invalid API key:

Example request:
{
"data": {
"status": 401,
"code": "UNAUTHORIZED",
"message": "Invalid or unspecified identity."
}
}