> ## Documentation Index
> Fetch the complete documentation index at: https://dev.moonpay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate API clients

> Generate type-safe API clients from the OpenAPI specification.

The MoonPay Developer Platform API is defined using an OpenAPI 3.1 specification. You can use this spec to generate typed clients for any language.

## Full specification

The OpenAPI 3.1 specification is served at **[https://api.moonpay.com/platform/openapi.json](https://api.moonpay.com/platform/openapi.json)**. Use this URL in your codegen config or download the file for offline use.

## Usage

### TypeScript / JavaScript

Use `@hey-api/openapi-ts` to generate TypeScript types:

```bash theme={null}
npm install -D @hey-api/openapi-ts
```

```ts openapi-ts.config.ts theme={null}
import { defineConfig } from "@hey-api/openapi-ts";

export default defineConfig({
  input: "https://api.moonpay.com/platform/openapi.json",
  output: {
    path: "./src/gen",
  },
  plugins: [
    {
      name: "@hey-api/typescript",
      enums: false,
    },
  ],
});
```

```bash theme={null}
npx openapi-ts
```

### Dart / Flutter

Use `openapi_generator` with build\_runner:

```yaml theme={null}
# pubspec.yaml
dev_dependencies:
  build_runner: ^2.4.0
  openapi_generator: ^5.0.0

openapi_generator:
  input_spec:
    path: https://api.moonpay.com/platform/openapi.json
  generator_name: dart
  output_directory: lib/gen
```

```bash theme={null}
flutter pub run build_runner build
```

### Other Languages

Use the [OpenAPI Generator](https://openapi-generator.tech/) CLI to generate clients for 50+ languages:

```bash theme={null}
# Install
npm install @openapitools/openapi-generator-cli -g

# Generate (examples)
openapi-generator-cli generate -i https://api.moonpay.com/platform/openapi.json -g kotlin -o ./gen
openapi-generator-cli generate -i https://api.moonpay.com/platform/openapi.json -g swift5 -o ./gen
openapi-generator-cli generate -i https://api.moonpay.com/platform/openapi.json -g python -o ./gen
openapi-generator-cli generate -i https://api.moonpay.com/platform/openapi.json -g go -o ./gen
```

See the [full list of generators](https://openapi-generator.tech/docs/generators).
