top

Authentication

To authenticate, add an Authorization header to your API request that contains an API Key.

API Keys

API Keys allow you to use another method of authentication separate from your account username and password. API Keys add an additional layer of security for your account because they limit access only to the API resources.

To use keys, you must set a plain text header named Authorization with the contents of the header being "XXX" where XXX is your API Secret Key.

To obtain an API Key, you will need an active SWFI account and can request them by contacting SWFI Support.

Example Header
curl -v -X GET https://api.swfi.com/v1/entities \
-H "Accept: application/json" \
-H "Authorization: $API_KEY"

API Root

The host for API requests is https://api.swfi.com/v1.

All requests must be made over HTTPS. The API does not support HTTP.

Requests

You must provide an Authorization header as described in Authentication.

HTTP Verbs

VerbDescription
GETRetrieve a resource or group of resources
POSTCreate a new resource
PUTUpdate an existing resource
DELETEDelete an existing resource

Version 1 of the SWFI API only allows for GET requests.

Accept Header

The API provides JSON responses. It doesn't currenly require the accept header but might in the future. If not set, the API will almost always use application/json.

Some resources offer direct file downloads and the "Content-Type" header should match the type of document.

Example Accept Header
curl -v -X GET https://api.swfi.com/v1/entities \
-H "Accept: application/json" \
-H "Authorization: $API_KEY"

Arrays of Data

When you send an array of data in a GET request, you will need to include the parameter multiple times on the URL. The parameter name does not require brackets.

The specific resource documentation will determine whether you are able to supply arrays of data as filters. Browse through the Collections to determine if you can supply arrays of data.

If the resource does not accept arrays of data, then the first supplied value will be used.

Example Request with Array of Data
curl -v -X GET https://api.swfi.com/v1/entities?region=Asia&region=Europe \
-H "Accept: application/json" \
-H "Authorization: $API_KEY"

Responses

Success

All responses are returned in JSON format. We specify this by sending the Content-Type header.

Responses to a list retrieval or a lookup will include a JSON object payload where the "data" key includes the data requested. List retrievals will include the total_items key that can be used with Pagination.

Retrieve a List
curl -v -X GET https://api.swfi.com/v1/:resource \
-H "Accept: application/json" \
-H "Authorization: $API_KEY"
 
HTTP/1.1 200 OK
Content-Type: application/json
{
  "data": [{}, {}],
  "total_items": integer
}
Retrieve One
curl -v -X GET https://api.swfi.com/v1/:resource/:_id \
-H "Accept: application/json" \
-H "Authorization: $API_KEY"
 
HTTP/1.1 200 OK
Content-Type: application/json
{
  "data": {}
}

Errors

Sometimes your API call will generate an error. Here you will find additional information about what to expect if you don't format your request properly, or we fail to properly process your request.

Status CodeDescription
400Bad request
401Requires authentication
406Missing Accept header
429Too many requests/Rate limit exceeded
500Internal server error
Failed Request Example
curl -v -X GET https://api.swfi.com/v1/:resource/:_id \
-H "Accept: application/json" \
-H "Authorization: $API_KEY"
 
HTTP/1.1 404 RESOURCE NOT FOUND
Content-Type: application/json
{
  "errors": [
      {
          "path_parameter": "_id",
          "message": "Not found"
      }
  ],
  "status": 404
}

Status Codes

Below is a table containing descriptions of the various status codes we currently support against various resources.

Status CodeDescription
200No error
201Successfully created
204Successfully deleted
400Bad request
401Require authentication
404Not found
406Missing Accept header
429Too many requests/Rate limit exceeded
500Internal server error

Rate Limits

All calls within the Web API are allotted a specific number of requests per refresh period. View the table below for the rate limits.

Refresh PeriodRate
10 minutes10 requests per second

Once this threshold has been reached, we will return a 429 response code.

Rate Limit Example
siege -v -b -c 40 -r 1 --header="Authorization: $API_KEY" https://api.swfi.com/v1/compass \
 
"GET https://api.swfi.com/v1/compass HTTP/1.1" 200 17567 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 200 17567 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 429 162 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 429 162 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 429 162 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 429 162 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 429 162 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 200 17567 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 200 17567 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 429 162 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 200 17567 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 429 162 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 429 162 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 429 162 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 429 162 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 429 162 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 429 162 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 429 162 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 429 162 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 429 162 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 429 162 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 200 17567 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 429 162 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 429 162 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 429 162 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 429 162 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 200 17567 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 429 162 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 429 162 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 429 162 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 429 162 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 429 162 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 429 162 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 429 162 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 200 17567 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 200 17567 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 200 17567 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 200 17567 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 200 17567 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
"GET https://api.swfi.com/v1/compass HTTP/1.1" 200 17567 "-" "Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.0.7"
Documentation as of 10/19/2022