If your project requires exchange rates from the National Bank of Poland (NBP), you can use their API available at https://api.nbp.pl/. In this guide, I’ll show you how to create a custom connector for Power Platform apps so you can globally integrate and use this API.

I won’t cover the steps for using the custom connector wizard. Instead, I’ll use a Swagger source that I created. Simply copy the provided code and start using it.

  1. Open your solution in Power Platform.
  2. Navigate to New → Automation → Custom Connector.
  3. Switch to the Swagger editor and paste the following code, which you can find in my GitHub repository:
swagger
swagger: '2.0'
info:
  title: NBP Web API
  description: Umożliwia pobranie kursów walut NBP za pomocą serwisu api.nbp.pl.
  version: '1.0'
host: api.nbp.pl
basePath: /api/exchangerates
schemes:
  - https
consumes: []
produces: []
paths:
  /tables/{table}/:
    get:
      responses:
        default:
          description: default
          schema: {}
      operationId: tablesABC
      parameters:
        - name: table
          in: path
          required: true
          type: string
          default: A
          x-ms-summary: Typ tabeli (A, B, lub C)
          enum:
            - A
            - B
            - C
          description: >-
            Tabela A kursów średnich walut obcych, Tabela B kursów średnich
            walut obcych, Tabela C kursów kupna i sprzedaży walut obcych
        - name: Accept
          in: header
          required: false
          type: string
          enum:
            - application/json
            - application/xml
          x-ms-visibility: advanced
          default: application/json
      summary: Aktualnie obowiązująca tabela kursów
      description: Aktualnie obowiązująca tabela kursów typu {table}
  /tables/{table}/last/{topCount}/:
    get:
      responses:
        default:
          description: default
          schema: {}
      summary: Seria ostatnich kursów z tabeli kursów
      description: Seria ostatnich {topCount} tabel kursów typu {table}
      operationId: tablesABClastX
      parameters:
        - name: table
          in: path
          required: true
          type: string
          description: >-
            Tabela A kursów średnich walut obcych, Tabela B kursów średnich
            walut obcych, Tabela C kursów kupna i sprzedaży walut obcych
          x-ms-summary: Typ tabeli (A, B, lub C)
          enum:
            - A
            - B
            - C
          default: A
        - name: topCount
          in: path
          required: true
          type: integer
          default: 14
          format: int64
          x-ms-summary: Seria ostatnich X kursów
        - name: Accept
          in: header
          required: false
          type: string
          default: application/json
          enum:
            - application/json
            - application/xml
          x-ms-visibility: advanced
  /tables/{table}/today/:
    get:
      responses:
        default:
          description: default
          schema: {}
      operationId: tablesABCtoday
      parameters:
        - name: table
          in: path
          required: true
          type: string
          default: A
          description: >-
            Tabela A kursów średnich walut obcych, Tabela B kursów średnich
            walut obcych, Tabela C kursów kupna i sprzedaży walut obcych
          x-ms-summary: Typ tabeli (A, B, lub C)
          enum:
            - A
            - B
            - C
        - name: Accept
          in: header
          required: false
          type: string
          default: application/json
          x-ms-visibility: advanced
          enum:
            - application/json
            - application/xml
      description: >-
        Tabela kursów typu {table} opublikowana w dniu dzisiejszym (albo brak
        danych)
      summary: Aktualnie obowiązująca tabela kursów opublikowana w dniu dzisiejszym
  /rates/{table}/{code}/{date}/:
    get:
      responses:
        default:
          description: default
          schema:
            type: object
            properties:
              rates:
                type: array
                items:
                  type: object
                  properties:
                    'no':
                      type: string
                      description: 'no'
                    effectiveDate:
                      type: string
                      description: effectiveDate
                    mid:
                      type: number
                      format: float
                      description: kurs
                      title: ''
                description: rates
      operationId: ratesCODEDate
      summary: Kurs waluty z tabeli kursów typu opublikowany w dniu
      parameters:
        - name: table
          in: path
          required: true
          type: string
          default: A
          enum:
            - A
            - B
            - C
          x-ms-summary: Typ tabeli (A, B, lub C)
          description: >-
            Tabela A kursów średnich walut obcych, Tabela B kursów średnich
            walut obcych, Tabela C kursów kupna i sprzedaży walut obcych
        - name: code
          in: path
          required: true
          type: string
          x-ms-summary: Trzyliterowy kod waluty
          description: ISO 4217
        - name: date
          in: path
          required: true
          type: string
          description: ''
          format: date
          x-ms-summary: Data w formacie RRRR-MM-DD
        - name: Accept
          in: header
          required: false
          type: string
          default: application/json
          enum:
            - application/json
            - application/xml
          x-ms-visibility: advanced
      description: >-
        Kurs waluty {code} z tabeli kursów typu {table} opublikowany w dniu
        {date} (albo brak danych)
  /tables/{table}/{startDate}/{endDate}/:
    get:
      responses:
        default:
          description: default
          schema: {}
      parameters:
        - name: table
          in: path
          required: true
          type: string
          default: A
          description: >-
            Tabela A kursów średnich walut obcych, Tabela B kursów średnich
            walut obcych, Tabela C kursów kupna i sprzedaży walut obcych
          x-ms-summary: Typ tabeli (A, B, lub C)
          enum:
            - A
            - B
            - C
        - name: startDate
          in: path
          required: true
          type: string
          x-ms-summary: Data w formacie RRRR-MM-DD
          format: date
        - name: endDate
          in: path
          required: true
          type: string
          x-ms-summary: Data w formacie RRRR-MM-DD
          format: date
        - name: Accept
          in: header
          required: false
          type: string
          default: application/json
          x-ms-visibility: advanced
          enum:
            - application/json
            - application/xml
      description: >-
        Seria tabel kursów typu {table} opublikowanych w zakresie dat od
        {startDate} do {endDate} (albo brak danych) ((przy czym pojedyncze
        zapytanie nie może obejmować przedziału dłuższego, niż 93 dni))
      operationId: tablesABCStartdateEnddate
      summary: Kurs waluty z tabeli kursów typu opublikowany pomiędzy datami
  /rates/{table}/{code}/:
    get:
      responses:
        default:
          description: default
          schema: {}
      summary: Aktualnie obowiązujący kurs waluty
      operationId: ratesCODE
      description: Aktualnie obowiązujący kurs waluty {code} z tabeli kursów typu {table}
      parameters:
        - name: table
          in: path
          required: true
          type: string
          default: A
          x-ms-summary: Typ tabeli (A, B, lub C)
          enum:
            - A
            - B
            - C
          description: >-
            Tabela A kursów średnich walut obcych, Tabela B kursów średnich
            walut obcych, Tabela C kursów kupna i sprzedaży walut obcych
        - name: code
          in: path
          required: true
          type: string
          x-ms-summary: Trzyliterowy kod waluty
          description: ISO 4217
        - name: Accept
          in: header
          required: false
          type: string
          default: application/json
          enum:
            - application/json
            - application/xml
          x-ms-visibility: advanced
  /rates/{table}/{code}/last/{topCount}/:
    get:
      responses:
        default:
          description: default
          schema: {}
      operationId: ratesCODElastX
      summary: Seria ostatnich obowiązujący kurów waluty
      parameters:
        - name: table
          in: path
          required: true
          type: string
          default: A
          description: >-
            Tabela A kursów średnich walut obcych, Tabela B kursów średnich
            walut obcych, Tabela C kursów kupna i sprzedaży walut obcych
          x-ms-summary: Typ tabeli (A, B, lub C)
          enum:
            - A
            - B
            - C
        - name: code
          in: path
          required: true
          type: string
          x-ms-summary: Trzyliterowy kod waluty
          description: ISO 4217
        - name: topCount
          in: path
          required: true
          type: integer
          default: 14
          x-ms-summary: Seria ostatnich X kursów
          format: int64
        - name: Accept
          in: header
          required: false
          type: string
          default: application/json
          enum:
            - application/json
            - application/xml
  /rates/{table}/{code}/today/:
    get:
      responses:
        default:
          description: default
          schema: {}
      summary: Aktualnie obowiązujący kurs waluty opublikowany w dniu dzisiejszym
      operationId: ratesCODEtoday
      description: >-
        Kurs waluty {code} z tabeli kursów typu {table} opublikowany w dniu
        dzisiejszym (albo brak danych)
      parameters:
        - name: table
          in: path
          required: true
          type: string
          default: A
          x-ms-summary: Typ tabeli (A, B, lub C)
          enum:
            - A
            - B
            - C
          description: >-
            Tabela A kursów średnich walut obcych, Tabela B kursów średnich
            walut obcych, Tabela C kursów kupna i sprzedaży walut obcych
        - name: code
          in: path
          required: true
          type: string
          x-ms-summary: Trzyliterowy kod waluty
          description: ISO 4217
        - name: Accept
          in: header
          required: false
          type: string
          default: application/json
          enum:
            - application/json
            - application/xml
          x-ms-visibility: advanced
  /rates/{table}/{code}/{startDate}/{endDate}/:
    get:
      responses:
        default:
          description: default
          schema: {}
      parameters:
        - name: table
          in: path
          required: true
          type: string
          default: A
          description: >-
            Tabela A kursów średnich walut obcych, Tabela B kursów średnich
            walut obcych, Tabela C kursów kupna i sprzedaży walut obcych
          x-ms-summary: Typ tabeli (A, B, lub C)
          enum:
            - A
            - B
            - C
        - name: code
          in: path
          required: true
          type: string
          description: ISO 4217
          x-ms-summary: Trzyliterowy kod waluty
        - name: startDate
          in: path
          required: true
          type: string
          x-ms-summary: Data w formacie RRRR-MM-DD
          format: date
        - name: endDate
          in: path
          required: true
          type: string
          x-ms-summary: Data w formacie RRRR-MM-DD
          format: date
        - name: Accept
          in: header
          required: false
          type: string
          default: application/json
          x-ms-visibility: advanced
          enum:
            - application/json
            - application/xml
      description: >-
        Seria tabel kursów typu {table} opublikowanych w zakresie dat od
        {startDate} do {endDate} (albo brak danych) ((przy czym pojedyncze
        zapytanie nie może obejmować przedziału dłuższego, niż 93 dni))
      operationId: ratesCODEStartdateEnddate
      summary: Kurs waluty z tabeli kursów typu opublikowany pomiędzy datami
definitions: {}
parameters: {}
responses: {}
securityDefinitions: {}
security: []
tags: []
Expand

Go back to the General tab, add a connector icon if needed, and enter the desired Connector Name:

Save your changes by clicking Update Connector. With these steps, your custom connector is ready to use. Our new custom connector should appear under the Custom type option. Select it to integrate NBP exchange rates into your workflow..


Let’s add a simple one named “Aktualnie obowiązująca tabela kursów” (Current exchange rates table):

This one is simple. You can choose from only three tables. In table A, NBP provides the most commonly used currencies in Poland:

  • Table A: Middle exchange rates for foreign currencies.
  • Table B: Middle exchange rates for foreign currencies.
  • Table C: Buy and sell prices for foreign currencies.

I recommend reading the documentation in both Polish and English for more details.

The API offers nine operations; one of them is to retrieve the rate for a given currency at a specific time. For example, to get the rate for the Norwegian Krone (NOK) from 2024-11-15, use the operation titled “Kurs waluty z tabeli kursów typu opublikowany w dniu” (Exchange rate from the exchange rates table published on a specific day), to do this: Select table A, Enter the currency code: NOK, and set the date: 2024-11-15:

OK, so let’s se the output:

We receive a JSON with the necessary information, including the currency code and the mid (calculated average exchange rate).

JSON
"body": {
  "table": "A",
  "currency": "korona norweska",
  "code": "NOK",
  "rates": [
    {
      "no": "222/A/NBP/2024",
      "effectiveDate": "2024-11-15",
      "mid": 0.3681
    }
  ]
}

And that’s all! Feel free to use this connector as much as you need.