You can specify the environments where your server is deployed.

Single URL environments

api.yml
1name: api
2environments:
3 Production: https://www.yoursite.com
4 Staging:
5 docs: This staging environment is helpful for testing!
6 url: https://www.staging.yoursite.com

Multiple URLs per environment

You can specify multiple URLs per environment. This is helpful if you have a microservice architecture, and you want a single SDK to interact with multiple servers.

api.yml
1environments:
2 Production:
3 urls:
4 Auth: https://auth.yoursite.com
5 Plants: https://plants.yoursite.com
6 Staging:
7 urls:
8 Auth: https://auth.staging.yoursite.com
9 Plants: https://plants.staging.yoursite.com

If you choose to use this feature, you must specify a url for each service you define:

auth.yml
1service:
2 url: Auth
3 base-path: /auth
4 ...

Default environment

You can also provide a default environment:

api.yml
1name: api
2environments:
3 Production: https://www.yoursite.com
4 Staging:
5 docs: This staging environment is helpful for testing!
6 url: https://www.staging.yoursite.com
7default-environment: Production
By providing a default environment, the generated SDK will be setup to hit that URL out-of-the-box.

Base path

If you would like all of your endpoints to be prefixed with a path, use base-path.

In the example below, every endpoint is prefixed with a /v1:

api.yml
1name: api
2base-path: /v1

Audiences

If you have listed environments that you want to filter, you can leverage audiences.

api.yml
1audiences:
2 - public
3
4environments:
5 Dev:
6 url: https://dev.com
7 Prod:
8 url: https://rewards-api.getkard.com
9 audiences:
10 - external