• Ask the Community
  • API: getting user statement

Hi everyone,

I'm getting below error code in sandbox or production mode after user authorized
our test/production app by QR barcode scanning,

Response id to help bunq debug: 534ccd33-fa4e-4976-8dd8-fc3b2a391227. 
Error message: The item you requested could not be found.

after getting "access_token" from "/v1/token", we create ApiContext:
Below is the code in C#

apiContext = ApiContext.Create(ApiEnvironmentType.SANDBOX, access_token, DeviceDescription);

BunqContext.LoadApiContext(apiContext);

var statement = CustomerStatementExport.Create(
	"CSV",
	DateTime.Now.AddDays(-3).ToString("yyyy-MM-dd"), 
	DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"),
	null,
	"UK_US"
 );
```									   
And the response is :

Response id to help bunq debug: cab70137-8e37-4cfc-bf0b-f2e977296c8b.
Error message: The item you requested could not be found.

    @Seyed-Golden-Butterfly#89793 Maybe it's the language code? UK_US must be en_US, i think 🙂

      Actually, That's not a language UK_US is standard to define dot as decimal separator and comma as digit grouping. I did also try with en_US and null

        @Seyed-Golden-Butterfly#89800 You're right, excuse me

          @Seyed-Golden-Butterfly#89793 Also tested with a monetary account id, instead of null ?

            @Bastiaan#89804
            if monetaryaccoundit is null, SDK get this from BunqContext.UserContext.PrimaryMonetaryAccountBank.Id.Value in BunqModel abstract that get current monetaryaccountid related tu the main user account that was loaded from :

            BunqContext.LoadApiContext(apiContext);

              @MasonChase#89827 I've tried the same, but with the PHP SDK. I'm receiving the following error:

              The response header "X-Bunq-Client-Response-Id" or "x-bunq-client-response-id"; could not be found.

                @MasonChase#89793 I missed an important part, it looks like you're using an oAuth token instead of a "normal" API-key.
                Apparently this endpoint is not accesible when you're using an oAuth token.

                  I'm sorry, which oauth endpoint are you referring ? what is the URL?

                    @MasonChase#89878 The endpoint to create the customer statement CSV. Looks like this one is not accessible if you're using an oAuth token (API-key)

                      Anyone from Bunq can comment on this? Documentation is missing a lot of details
                      even sandbox URL for oauth wasn't listed .

                        @MasonChase

                        An oAuth token allows you to perform the following actions:

                        • Read only access to the Monetary Accounts.
                        • Read access to Payments & Transactions.
                        • Create new Payments, but only between Monetary Accounts belonging to the same user.
                        • Create new Draft-Payments.
                        • Change the primary monetary to which a Card is linked to.
                        • Read only access to Request-Inquiries and Request-Responses.

                        Creating an CSV statement is not (yet) part of this list. I've reported this to development at bunq.

                          Tim changed the title to API: getting user statement.

                            @Bastiaan#89908 One could interpret 'read access to accounts/payments/transactions' in different ways. I made a similar mistake when I thought callbacks were available with OAuth, as like statements they provide a kind of read access to transactions...

                            It would have been better to explicitly list the endpoints that are available with OAuth.

                              I wonder how accounting softwares are able to fetch statement with bunq if this feature is disabled

                                @MasonChase#90441 It is quite easy to create an export manually by using the standard payment endpoints. This is what bunqDesktop does as well when using the custom export page. And not every accounting software uses OAuth over the standard API keys.

                                  @Gregory Do you suggest to use Qr Barcode API key generation? this would mean we will get a full feature api key access to the user's account?

                                    @MasonChase#90446 No I mean that you can just use the regular payment endpoints which are available with OAuth and create the export yourself. In the end the bunq export is litteraly just the Payment API data stored as CSV.