-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcurrencyfair.yaml
More file actions
9052 lines (8953 loc) · 316 KB
/
currencyfair.yaml
File metadata and controls
9052 lines (8953 loc) · 316 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
openapi: 3.0.0
info:
title: CurrencyFair eXternal Services API
version: 2.0.0
contact:
name: Customer Support
email: support@currencyfair.com
x-logo:
url: https://assets.currencyfair.com/img/logo-currencyfair.svg
description: |
# Introduction
The CurrencyFair eXternal Services API is REST-ful API that allows approved API users to perform various
operations on their CurrencyFair wallet.
In order to use the API you will need to have a CurrencyFair account. You can [sign up here](https://app.currencyfair.com/register/personal#business).
It is designed to be used by server-side clients, to allow our business and institutional clients to build
their own integrations with our system.
The production API server is https://xsapi.currencyfair.com
The sandbox servers are assigned to users when they register as an API partner.
The following headers can be attached to HTTPS calls to our API:
- `x-api-key: <secret provided by CurrencyFair>` - must be sent in every request, grants access to the API (authentication is performed separately).
- `Authentication: Bearer <api_token>` - must be set to authenticate the call. Read more in the [Authentication](#section/Authentication) section.
- `Content-Type: application/json` - must be set on POST/PUT/PATCH calls when a JSON body payload is sent.
- `Accept-Language: <two_letter_language_code>` - to set the language. Defaults to `en` if not provided. Currently supported languages: `en`, `fr`, `de`.
In order to use our API you need to first signup as our API partner. Please contact our customer service
to arrange this.
Once you are our API partner, a new Sub User will be created under your company account. That Sub User will
have its own long-lived Authorization Code that allows it to authenticate using the
[authentication endpoint](#tag/Authentication).
<SecurityDefinitions />
**The Authorization Code must be stored in secure location, and never displayed to the public**.
Sub Users can perform certain operations on behalf of their parent user, like Exchange, Transfer Out or Send Money.
The scope of what a Sub User is allowed to do is controlled via the User Management panel in our web application.
In further text the term "user" will be used to described the currently authenticated Sub User.
Please read more about authentication process in the [authentication endpoint](#tag/Authentication) description.
# Error Responses
CurrencyFair follows the error response format proposed in [RFC 7807](https://tools.ietf.org/html/rfc7807) also known as Problem Details for HTTP APIs.
## Basic error message
The base schema for all error responses is as follows:
<SchemaDefinition schemaRef="#/components/schemas/ApiNotFoundError" exampleRef="#/components/examples/NotFound" />
## Error message with validation messages
Endpoints which receive a payload will perform validation of the input data, and return a `HTTP 422` error response
with `validation_messages` property.
The structure of the `validation_messages` is as follows:
```json
{
"<input_property_name>": {
"<error_type>": "<error_message>",
...
},
...
}
```
For example if an endpoints requires an `iban` field, which should be a valid IBAN number, and the provided value
is not correct, the API will return an error like in the example below:
<SchemaDefinition schemaRef="#/components/schemas/ApiErrorWithValidationMessages" exampleRef="#/components/examples/ValidationMessages" />
## Error message with failure messages
If the endpoint was unable to perform the requested operation, it may return a HTTP 4xx error response with `failure_messages` property.
The structure of the `failure_messages` is as follows:
```json
{
"<error_code>": "<error_message>",
...
}
```
<SchemaDefinition schemaRef="#/components/schemas/ApiErrorWithFailureMessages" exampleRef="#/components/examples/FailureMessages" />
## MFA Required error message
This error is returned if an endpoint requires MFA to be performed prior to running it. Please see the [MFA section](#section/Multi-Factor-authentication) for more details.
<SchemaDefinition schemaRef="#/components/schemas/ApiErrorWithMfaDetails" exampleRef="#/components/examples/MfaRequired" />
## Rate limited error message
To ensure the CurrencyFair API remains stable to all users, CurrencyFair may throttle a client's requests if it deems
the number of requests is excessive.
If this occurs, the API will return a `429 Too Many Requests` response. Upon receiving a 429 response the client
should resubmit failed requests using the the [backoff](https://en.wikipedia.org/wiki/Exponential_backoff) approach,
where your code performs a series of retries with increasing delays between each retry.
<SchemaDefinition schemaRef="#/components/schemas/ApiTooManyRequestsError" />
# HAL links
Our API uses [HAL](https://en.wikipedia.org/wiki/Hypertext_Application_Language) links.
These added properties are not covered in this documentation as they are auto-generated.
# Multi Factor Authentication
In order to call Multi Factor Authentication (MFA) secured endpoints in our API, the client must have:
- a secret MFA token
- an MFA device ID
This information is provided as part of the API partner on-boarding process.
The MFA (aka 2FA) process in our API is as follows:
- Client makes normal POST call to a MFA protected endpoint (it sends all the data like there is no MFA on the endpoint)
- The API returns HTTP 401 with MFA details that include:
- X-CF-MFA-FOLLOWON-ID: <integer>
- Client uses its secret token for MFA authorization and performs calculation of the "MFA code"
- Client repeats **exactly the same POST call**, but with these headers added:
- X-CF-MFA-FOLLOWON-ID: <integer>
- X-CF-MFA-DEVICE-ID: <mfa_device_identifier>
- X-CF-MFA-CODE: <the_calculated_MFA_code>
This time the call will pass through the MFA layer and the endpoints will respond normally.
The MFA is valid for 15 minutes, so if you call the same endpoint again it may not ask for MFA verification.
# Forms
Several of our endpoints are powered by a simple form fields system, where the POST endpoints receives a "form"
that is defined by its "fields" endpoints.
Example:
`GET /users/{userId}/namedDepositors/fields` - returns a list of these "fields":
- `nameMessage` - type: message
- `name` - required, type: text
- `description` - required, type: text
and the `POST /users/{userId}/namedDepositors` - sets up a named depositor, expects these fields:
- `name`
- `description`
This way of serving form fields is a UI-focused approach. It allows us to easily
update forms in our applications according to business rules. The forms in our applications are rendered
automatically based on the fields definitions.
For server-side API clients access, using a "fields" endpoint may not always be necessary. For example the
Named Depositor fields are not likely to change and they don't depend on the user or any other parameters.
However certain endpoints like `/countryAccountConfigs/{countryId}` return a list of fields which differ
based on the selected `countryId`.
The field definition object supports many more field types than those currently required for Named Depositors or setting
up a User Account. It is used by our applications to render UI in other parts of the application, not covered by
this API. However, it is likely that new features added to this API will use forms.
The full documentation for forms is available here: https://github.com/CurrencyFair/xsapi/blob/master/docs/Forms.md
## Field definition
<SchemaDefinition schemaRef="#/components/schemas/Field" />
security:
- api_key: []
x-amazon-apigateway-api-key-source: HEADER
x-amazon-apigateway-request-validators:
params-only:
validateRequestBody: false
validateRequestParameters: true # Specifies whether to validate the required request parameters
x-tagGroups:
- name: Authenticate
tags:
- Authentication
- name: How CurrencyFair works, money-wise
tags:
- Introduction to money operations
- name: Sending money in
tags:
- Depositing
- Named Depositors
- name: Exchanging money
tags:
- Quote and Exchange Money
- Marketplace
- name: Sending money out
tags:
- Recipient Bank Accounts
- Transfer Out
- Transfer Approvals
- Send Money
- name: Informational endpoints
tags:
- Countries & Currencies
- User Information
tags:
- name: Authentication
- name: Countries & Currencies
description: |
These endpoints provide information related to countries and currencies, and what level of support CurrencyFair
provides for each. For example, you can query these endpoints to determine a default currency for a country, or to see
if CurrencyFair allows registration for a particular country.
- name: User Information
description: |
These endpoints provide generic, user-specific information.
- name: Introduction to money operations
description: |

There are 3 basic operations in our system:
- `Deposit` - In our UI, this is called "Top Up", "Transfer In" or "Request payment" which are all variants of depositing in money into your CurrencyFair wallet.
- `Exchange` - Once money has been deposited, exchanging money in a user's currency wallet into another currency wallet.
- `Transfer Out` - Once you have exchanged on the CurrencyFair platform, transferring money from CurrencyFair wallet into an external bank account.
A combination of these 3 operations (Deposit -> Exchange -> Transfer Out) is known technically as an `Automatic Quick Trade` or `AQT`. The customer facing description (shown in UI) is called a "Send Money" operation.
There are 2 ways the `exchange` operation can be made:
- `Quick Trade` - this is an instant exchange with the rate CurrencyFair offers at a given moment.
- `Marketplace Trade` - this is placing a trade "order", that gets "matched" when another customer places an order in an opposite currency pair
for a similar value. It may take longer to happen, but a user can specify the desired exchange rate manually,
and then wait for it to be matched.
- name: Depositing
description: |
Depositing funds into a CurrencyFair account requires [creating a deposit](#operation/createUsersDeposit). There are
multiple methods for creating a Deposit:
1. Using a [Named Depositor](#tag/Named-Depositors). This is the preferred method.
2. Using an [existing User Bank Account](#tag/Recipient-Bank-Accounts).
3. By passing only a `currency` and `amount`, in which case a [Recipient Bank Account](#tag/Recipient-Bank-Accounts) will be created automatically.
Before creating a deposit you can determine the available payment methods for the deposit currency using the
[getPaymentMethodsWithTransferTimes](#operation/getPaymentMethodsWithTransferTimes) endpoint.
In order to ensure seamless deposits, CurrencyFair requires that users include a reference in the
reference field of the bank transfer. This reference usually consists of a user's CurrencyFair ID (CFID).
To determine the exact reference required for a bank account refer to the the `reference` field
returned from the [getCurrencyfairAccount](#operation/getCurrencyfairAccount) request.
There is no fee to deposit funds into CurrencyFair.
- name: Named Depositors
description: |
A Named Depositor is a person or business transferring funds into your CurrencyFair wallet. The closer a
Named Depositor name matches the actual bank account name, the greater chance of a quick and seamless deposit.
If you are unsure, please use the person’s full name or the full company name.
- name: Quote and Exchange Money
description: |
Quote and Exchange Money endpoints are used to retrieve quotes and bank rate comparisons, as well as execute
`Quick Trade` orders.
A `Quick Trade` refers to an instant currency exchange order. This differs to a [Marketplace](#tag/Marketplace)
order, where the rate is configurable and the execution time of the order depends on how quickly your rate can be
matched.
- name: Marketplace
description: |
The CurrencyFair Marketplace is where users can buy and sell currencies at a rate of their choosing. User's orders
are matched with orders from other users.
Marketplace trades are only executed between trading hours. Information about a market's status and trading
hours can be found in the responses of the [getMarketplace](#operation/getMarketplace)
and [getMarketplaces](#operation/getMarketplaces) requests.
- name: Recipient Bank Accounts
description: |
Recipient Bank Accounts are user created Bank Accounts which you can transfer money to.
Before creating a Recipient Bank Account you can fetch the required account information using the
[getCountryAccountConfig](#operation/getCountryAccountConfig) endpoint. The account information can
be validated using the [bankAccountLookup](#operation/bankAccountLookup) endpoint.
The [requireBeneficiaryVerification](#operation/requireBeneficiaryVerification) endpoint can be used to
determine if creating an account requires additional verification data.
- name: Transfer Out
description: |
Transfer Out is the process of sending money from a customer's CurrencyFair wallet to a [Recipient](#tag/Recipient-Bank-Accounts).
- name: Send Money
description: |
Send money, or `Automatic Quick Trade`, refers to the combined action of depositing, exchanging and transferring funds to a
beneficiary. Further information on how Send Money operates can be found
[here](https://support.currencyfair.com/s/article/Can-my-money-be-automatically-exchanged-and-transferred-to-my-chosen-beneficiary-after-I-send-it-in).
paths:
"/oauth":
post:
summary: Authenticate
description: |
Successful authentication will produce an `OauthResponse` object which contains a token.
The token must be then put into each next API call, into `Authorization` header, in the following way:
```
Bearer {token}
```
Example:
```
Authorization: Bearer 3d22ddea15b15e65909463ed821dc6c5
```
tags:
- Authentication
operationId: oauth
security:
- api_key: []
parameters:
- $ref: "#/components/parameters/ApiKeyHeaderParam"
- $ref: "#/components/parameters/ContentTypeHeaderParam"
- $ref: "#/components/parameters/AcceptLanguageHeaderParam"
requestBody:
description: The form values for authentication.
content:
multipart/form-data:
schema:
type: object
properties:
grant_type:
description: Type of authentication. Use `authorization_code`.
type: string
default: authorization_code
code:
description: The long-lived secret token
type: string
client_id:
description: Type of client. Use `xsapi`.
type: string
default: xsapi
required:
- grant_type
- code
- client_id
examples:
xsapi:
$ref: "#/components/examples/OauthRequest"
responses:
'200':
description: Oauth response
content:
application/json:
schema:
$ref: "#/components/schemas/OauthResponse"
examples:
success:
summary: Successful authorization
value:
$ref: "resources/examples/oauth/oAuthResponse.json"
'400':
$ref: "#/components/responses/Unauthorized"
'401':
$ref: "#/components/responses/UnauthorizedMfaRequired"
'429':
$ref: "#/components/responses/TooManyRequests"
x-amazon-apigateway-integration:
x-amazon-apigateway-auth: NONE
httpMethod: "POST"
uri: "https://${stageVariables.url}/oauth"
passthroughBehavior: "when_no_match"
timeoutInMillis: 29000
type: "http"
requestParameters:
integration.request.header.xsapi-gateway-key: "stageVariables.gatewayKey"
integration.request.header.Content-Type: "method.request.header.Content-Type"
integration.request.header.Accept-Language: "method.request.header.Accept-Language"
integration.request.header.X-Forwarded-For: "context.identity.sourceIp"
integration.request.header.User-Agent: "context.identity.userAgent"
responses:
200:
statusCode: 200
400:
statusCode: 400
401:
statusCode: 401
429:
statusCode: 429
"/whoami":
get:
summary: Who Am I
description: Retrieves basic information about the logged in user.
operationId: getWhoAmI
security:
- api_key: []
Bearer: [] # Note there is no dash, this indicates AND
# Authorization Parameter is required for method request mapping to integration request.
parameters:
- $ref: "#/components/parameters/AuthorisationHeaderParam"
- $ref: "#/components/parameters/ApiKeyHeaderParam"
- $ref: "#/components/parameters/AcceptLanguageHeaderParam"
tags:
- User Information
responses:
'200':
description: Whoami entity
content:
application/json:
schema:
$ref: "#/components/schemas/WhoamiResponse"
examples:
entity:
description: Whoami Entity
value:
$ref: "resources/examples/whoami/whoamiEntity.json"
'401':
description: Authorisation error.
headers:
WWW-Authenticate:
schema:
type: string
description: Header name will be remapped to `x-amzn-Remapped-WWW-Authenticate`
'403':
$ref: "#/components/responses/Forbidden"
'429':
$ref: "#/components/responses/TooManyRequests"
x-amazon-apigateway-integration:
x-amazon-apigateway-auth: NONE
httpMethod: "GET"
uri: "https://${stageVariables.url}/whoami"
passthroughBehavior: "when_no_match"
timeoutInMillis: 29000
type: "http"
requestParameters:
integration.request.header.Authorization: "method.request.header.Authorization"
integration.request.header.xsapi-gateway-key: "stageVariables.gatewayKey"
integration.request.header.Accept-Language: "method.request.header.Accept-Language"
integration.request.header.X-Forwarded-For: "context.identity.sourceIp"
integration.request.header.User-Agent: "context.identity.userAgent"
responses:
200:
statusCode: 200
401:
statusCode: 401
responseParameters:
method.response.header.WWW-Authenticate: "integration.response.header.WWW-Authenticate"
403:
statusCode: 403
429:
statusCode: 429
"/countries":
get:
summary: Retrieve a list of Countries
description: |
Retrieves the full list of countries that CurrencyFair supports. Support
for a country does not imply registration capabilities, or deposit/transfer
capabilities.
operationId: getCountries
security:
- api_key: []
Bearer: []
parameters:
- $ref: "#/components/parameters/AuthorisationHeaderParam"
- $ref: "#/components/parameters/ApiKeyHeaderParam"
- $ref: "#/components/parameters/AcceptLanguageHeaderParam"
- $ref: "#/components/parameters/CurrencyCodeOptionalQueryParam"
- name: account
in: query
description: Use value `1` to get the list of Countries filtered by those which allow the setting up of a Bank Account.
required: false
schema:
type: integer
enum: [0, 1]
default: 0
tags:
- Countries & Currencies
responses:
'200':
description: Countries collection
content:
application/hal+json:
schema:
$ref: "#/components/schemas/CountriesCollection"
examples:
collection:
summary: Countries collection
value:
$ref: "resources/examples/countries/countriesCollection.json"
'401':
description: Authorisation error.
headers:
WWW-Authenticate:
schema:
type: string
description: Header name will be remapped to `x-amzn-Remapped-WWW-Authenticate`
'403':
$ref: "#/components/responses/Forbidden"
'422':
$ref: "#/components/responses/UnprocessableEntity"
'429':
$ref: "#/components/responses/TooManyRequests"
x-amazon-apigateway-request-validator: params-only
x-amazon-apigateway-integration:
x-amazon-apigateway-auth: NONE
httpMethod: "GET"
uri: "https://${stageVariables.url}/countries"
passthroughBehavior: "when_no_match"
timeoutInMillis: 29000
type: "http"
requestParameters:
integration.request.header.Authorization: "method.request.header.Authorization"
integration.request.header.xsapi-gateway-key: "stageVariables.gatewayKey"
integration.request.header.Accept-Language: "method.request.header.Accept-Language"
integration.request.header.X-Forwarded-For: "context.identity.sourceIp"
integration.request.header.User-Agent: "context.identity.userAgent"
integration.request.querystring.account: "method.request.querystring.account"
integration.request.querystring.currencyCode: "method.request.querystring.currencyCode"
responses:
200:
statusCode: 200
401:
statusCode: 401
responseParameters:
method.response.header.WWW-Authenticate: "integration.response.header.WWW-Authenticate"
403:
statusCode: 403
422:
statusCode: 422
429:
statusCode: 429
"/countries/{id}":
get:
summary: Retrieve a Country
description: Retrieves a Country.
operationId: getCountry
security:
- api_key: []
Bearer: []
parameters:
- $ref: "#/components/parameters/AuthorisationHeaderParam"
- $ref: "#/components/parameters/ApiKeyHeaderParam"
- $ref: "#/components/parameters/AcceptLanguageHeaderParam"
- name: id
in: path
description: Country ID
required: true
schema:
$ref: "#/components/schemas/IdParam"
tags:
- Countries & Currencies
responses:
'200':
description: Country object
headers:
Vary:
schema:
type: string
Cache-Control:
schema:
type: string
content:
application/hal+json:
schema:
$ref: "#/components/schemas/CountriesEntity"
examples:
entity:
summary: Country entity
value:
$ref: "resources/examples/countries/countriesEntity.json"
'401':
description: Authorisation error.
headers:
WWW-Authenticate:
schema:
type: string
description: Header name will be remapped to `x-amzn-Remapped-WWW-Authenticate`
'403':
$ref: "#/components/responses/Forbidden"
'404':
$ref: "#/components/responses/NotFound"
'429':
$ref: "#/components/responses/TooManyRequests"
x-amazon-apigateway-integration:
x-amazon-apigateway-auth: NONE
httpMethod: "GET"
uri: "https://${stageVariables.url}/countries/{id}"
passthroughBehavior: "when_no_match"
timeoutInMillis: 29000
type: "http"
requestParameters:
integration.request.header.Authorization: "method.request.header.Authorization"
integration.request.header.xsapi-gateway-key: "stageVariables.gatewayKey"
integration.request.header.Accept-Language: "method.request.header.Accept-Language"
integration.request.header.X-Forwarded-For: "context.identity.sourceIp"
integration.request.header.User-Agent: "context.identity.userAgent"
integration.request.path.id: "method.request.path.id"
responses:
200:
statusCode: 200
responseParameters:
method.response.header.Vary: "integration.response.header.Vary"
method.response.header.Cache-Control: "integration.response.header.Cache-Control"
401:
statusCode: 401
responseParameters:
method.response.header.WWW-Authenticate: "integration.response.header.WWW-Authenticate"
403:
statusCode: 403
404:
statusCode: 404
429:
statusCode: 429
"/currencies":
get:
summary: Retrieve a list of Currencies
description: Retrieves a collection of Currencies.
operationId: getCurrencies
security:
- api_key: []
Bearer: []
parameters:
- $ref: "#/components/parameters/AuthorisationHeaderParam"
- $ref: "#/components/parameters/ApiKeyHeaderParam"
- $ref: "#/components/parameters/AcceptLanguageHeaderParam"
- name: include_disabled
in: query
description: Use value `1` to retrieve a list of all currencies, including those which are disabled.
required: false
schema:
type: integer
- name: cf_client_account
in: query
description: Use value `1` to retrieve a list of currencies for which a CurrencyFair Bank Account
exists and that we accept deposits in.
required: false
schema:
type: integer
- name: account
in: query
description: Use value `1` to retrieve a list of currencies that can be used with a user Bank Account.
required: false
schema:
type: integer
- name: regional_entity
in: query
description: Use value `1` to retrieve a list of currencies for the supplied regional entity.
required: false
schema:
type: string
example: Singapore
tags:
- Countries & Currencies
responses:
'200':
description: Collection of Currencies
content:
application/hal+json:
schema:
$ref: "#/components/schemas/CurrenciesCollection"
examples:
entity:
summary: Currencies collection
value:
$ref: "resources/examples/currencies/currenciesCollection.json"
'401':
description: Authorisation error.
headers:
WWW-Authenticate:
schema:
type: string
description: Header name will be remapped to `x-amzn-Remapped-WWW-Authenticate`
'403':
$ref: "#/components/responses/Forbidden"
'422':
$ref: "#/components/responses/UnprocessableEntity"
'429':
$ref: "#/components/responses/TooManyRequests"
x-amazon-apigateway-request-validator: params-only
x-amazon-apigateway-integration:
x-amazon-apigateway-auth: NONE
httpMethod: "GET"
uri: "https://${stageVariables.url}/currencies"
passthroughBehavior: "when_no_match"
timeoutInMillis: 29000
type: "http"
requestParameters:
integration.request.header.Authorization: "method.request.header.Authorization"
integration.request.header.xsapi-gateway-key: "stageVariables.gatewayKey"
integration.request.header.Accept-Language: "method.request.header.Accept-Language"
integration.request.header.X-Forwarded-For: "context.identity.sourceIp"
integration.request.header.User-Agent: "context.identity.userAgent"
integration.request.querystring.include_disabled: "method.request.querystring.include_disabled"
integration.request.querystring.cf_client_account: "method.request.querystring.cf_client_account"
integration.request.querystring.account: "method.request.querystring.account"
integration.request.querystring.regional_entity: "method.request.querystring.regional_entity"
responses:
200:
statusCode: 200
401:
statusCode: 401
responseParameters:
method.response.header.WWW-Authenticate: "integration.response.header.WWW-Authenticate"
403:
statusCode: 403
422:
statusCode: 422
429:
statusCode: 429
"/currencies/{currencyCode}":
get:
summary: Retrieve a Currency
description: Retrieves a Currency.
operationId: getCurrencyByCurrencyCode
security:
- api_key: []
Bearer: []
parameters:
- $ref: "#/components/parameters/AuthorisationHeaderParam"
- $ref: "#/components/parameters/ApiKeyHeaderParam"
- $ref: "#/components/parameters/AcceptLanguageHeaderParam"
- $ref: "#/components/parameters/CurrencyCodeParam"
tags:
- Countries & Currencies
responses:
'200':
description: Currency object
content:
application/hal+json:
schema:
$ref: "#/components/schemas/CurrenciesEntity"
examples:
entity:
summary: Currency entity
value:
$ref: "resources/examples/currencies/currenciesEntity.json"
'401':
description: Authorisation error.
headers:
WWW-Authenticate:
schema:
type: string
description: Header name will be remapped to `x-amzn-Remapped-WWW-Authenticate`
'403':
$ref: "#/components/responses/Forbidden"
'404':
$ref: "#/components/responses/NotFound"
'429':
$ref: "#/components/responses/TooManyRequests"
x-amazon-apigateway-integration:
x-amazon-apigateway-auth: NONE
httpMethod: "GET"
uri: "https://${stageVariables.url}/currencies/{currencyCode}"
passthroughBehavior: "when_no_match"
timeoutInMillis: 29000
type: "http"
requestParameters:
integration.request.header.Authorization: "method.request.header.Authorization"
integration.request.header.xsapi-gateway-key: "stageVariables.gatewayKey"
integration.request.header.Accept-Language: "method.request.header.Accept-Language"
integration.request.header.X-Forwarded-For: "context.identity.sourceIp"
integration.request.header.User-Agent: "context.identity.userAgent"
integration.request.path.currencyCode: "method.request.path.currencyCode"
responses:
200:
statusCode: 200
401:
statusCode: 401
responseParameters:
method.response.header.WWW-Authenticate: "integration.response.header.WWW-Authenticate"
403:
statusCode: 403
404:
statusCode: 404
429:
statusCode: 429
"/comparisonQuotes":
post:
summary: Retrieve a Comparison Quote
operationId: returnComparisonQuote
description: |
Retrieves a comparison of rates between CurrencyFair and a traditional bank for a `BUY` or `SELL` transfer between two provided
currencies.
An example usage of this endpoint would be displaying a table comparing CurrencyFair's rates with a traditional bank's rates.
security:
- api_key: []
Bearer: []
parameters:
- $ref: "#/components/parameters/AuthorisationHeaderParam"
- $ref: "#/components/parameters/ApiKeyHeaderParam"
- $ref: "#/components/parameters/AcceptLanguageHeaderParam"
tags:
- Quote and Exchange Money
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/ComparisonQuotesBodyPayload"
description: If no parameters are provided the call will return a `SELL` quote
for €10,000 from `EUR` to `GBP`
responses:
'201':
description: ComparisonQuotes object
content:
application/json:
schema:
$ref: "#/components/schemas/ComparisonQuotesEntity"
'401':
description: Authorisation error.
headers:
WWW-Authenticate:
schema:
type: string
description: Header name will be remapped to `x-amzn-Remapped-WWW-Authenticate`
'403':
$ref: "#/components/responses/Forbidden"
'404':
$ref: "#/components/responses/NotFound"
'422':
$ref: "#/components/responses/UnprocessableEntity"
'429':
$ref: "#/components/responses/TooManyRequests"
x-amazon-apigateway-integration:
x-amazon-apigateway-auth: NONE
httpMethod: "POST"
uri: "https://${stageVariables.url}/comparisonQuotes"
passthroughBehavior: "when_no_match"
timeoutInMillis: 29000
type: "http"
requestParameters:
integration.request.header.Authorization: "method.request.header.Authorization"
integration.request.header.xsapi-gateway-key: "stageVariables.gatewayKey"
integration.request.header.Accept-Language: "method.request.header.Accept-Language"
integration.request.header.X-Forwarded-For: "context.identity.sourceIp"
integration.request.header.User-Agent: "context.identity.userAgent"
responses:
201:
statusCode: 201
401:
statusCode: 401
responseParameters:
method.response.header.WWW-Authenticate: "integration.response.header.WWW-Authenticate"
403:
statusCode: 403
404:
statusCode: 404
422:
statusCode: 422
429:
statusCode: 429
"/users/{userId}":
get:
summary: Retrieve a User
description: Retrieves a User associated with a provided User ID.
operationId: getUser
security:
- api_key: []
Bearer: []
tags:
- User Information
parameters:
- $ref: "#/components/parameters/AuthorisationHeaderParam"
- $ref: "#/components/parameters/ApiKeyHeaderParam"
- $ref: "#/components/parameters/AcceptLanguageHeaderParam"
- $ref: "#/components/parameters/UserIdParam"
responses:
'200':
description: User object
content:
application/hal+json:
schema:
$ref: "#/components/schemas/UsersEntity"
'401':
description: Authorisation error.
headers:
WWW-Authenticate:
schema:
type: string
description: Header name will be remapped to `x-amzn-Remapped-WWW-Authenticate`
'403':
$ref: "#/components/responses/Forbidden"
'404':
$ref: "#/components/responses/NotFound"
'429':
$ref: "#/components/responses/TooManyRequests"
x-amazon-apigateway-integration:
x-amazon-apigateway-auth: NONE
httpMethod: "GET"
uri: "https://${stageVariables.url}/users/{userId}"
passthroughBehavior: "when_no_match"
timeoutInMillis: 29000
type: "http"
requestParameters:
integration.request.header.Authorization: "method.request.header.Authorization"
integration.request.header.xsapi-gateway-key: "stageVariables.gatewayKey"
integration.request.header.Accept-Language: "method.request.header.Accept-Language"
integration.request.path.userId: "method.request.path.userId"
integration.request.header.X-Forwarded-For: "context.identity.sourceIp"
integration.request.header.User-Agent: "context.identity.userAgent"
responses:
200:
statusCode: 200
401:
statusCode: 401
responseParameters:
method.response.header.WWW-Authenticate: "integration.response.header.WWW-Authenticate"
403:
statusCode: 403
404:
statusCode: 404
429:
statusCode: 429
"/users/{userId}/summaries":
get:
summary: Retrieve a list of Summaries
description: |
Retrieves a collection of Summaries for a user. Each summary is associated with a currency and contains
information such available funds, pending deposits and open orders.
operationId: getUsersSummaries
security:
- api_key: []
Bearer: []
tags:
- User Information
parameters:
- $ref: "#/components/parameters/AuthorisationHeaderParam"
- $ref: "#/components/parameters/ApiKeyHeaderParam"
- $ref: "#/components/parameters/AcceptLanguageHeaderParam"
- $ref: "#/components/parameters/UserIdParam"
responses:
'200':
description: Summaries collection
content:
application/hal+json:
schema:
$ref: "#/components/schemas/SummariesCollection"
examples:
collection:
summary: Collection of Summary entities
value:
- $ref: "resources/examples/summaries/summariesCollection.json"
'401':
description: Authorisation error.
headers:
WWW-Authenticate:
schema:
type: string
description: Header name will be remapped to `x-amzn-Remapped-WWW-Authenticate`
'403':
$ref: "#/components/responses/Forbidden"
'429':
$ref: "#/components/responses/TooManyRequests"
x-amazon-apigateway-integration:
x-amazon-apigateway-auth: NONE
httpMethod: "GET"
uri: "https://${stageVariables.url}/users/{userId}/summaries"
passthroughBehavior: "when_no_match"
timeoutInMillis: 29000
type: "http"
requestParameters:
integration.request.header.Authorization: "method.request.header.Authorization"
integration.request.header.xsapi-gateway-key: "stageVariables.gatewayKey"
integration.request.header.Accept-Language: "method.request.header.Accept-Language"
integration.request.header.X-Forwarded-For: "context.identity.sourceIp"
integration.request.header.User-Agent: "context.identity.userAgent"
integration.request.path.userId: "method.request.path.userId"
responses:
200:
statusCode: 200
401:
statusCode: 401
responseParameters:
method.response.header.WWW-Authenticate: "integration.response.header.WWW-Authenticate"
403:
statusCode: 403
429:
statusCode: 429
"/users/{userId}/summaries/{currencyCode}":
get:
summary: Retrieve a Summary
description: |
Retrieves a Summary of a information related to a provided Currency for a User. A summary contains information such available funds,
pending deposits and open orders for a currency.
operationId: getUsersSummary
security:
- api_key: []
Bearer: []
tags:
- User Information
parameters:
- $ref: "#/components/parameters/AuthorisationHeaderParam"
- $ref: "#/components/parameters/ApiKeyHeaderParam"
- $ref: "#/components/parameters/AcceptLanguageHeaderParam"
- $ref: "#/components/parameters/UserIdParam"
- $ref: "#/components/parameters/CurrencyCodeParam"
responses:
'200':
description: Summary entity
content:
application/hal+json:
schema:
$ref: "#/components/schemas/SummariesEntity"
examples:
entity:
description: Summaries entity
value:
- $ref: "resources/examples/summaries/summariesEntity.json"
'401':
description: Authorisation error.
headers:
WWW-Authenticate:
schema:
type: string
description: Header name will be remapped to `x-amzn-Remapped-WWW-Authenticate`
'403':