Skip to content

Repository files navigation

Openapi CLI

🔐 Openapi® CLI

The command-line interface to interact with Openapi® APIs directly from your terminal

Build StatusCrates.ioLicenseRust Version
Linux Foundation Member

Overview

A command-line client for the APIs available at Openapi®. It provides direct terminal access to the Openapi® Marketplace, including OAuth and OAuth v2 token management, scope aliases, and sandbox support. With this CLI you can quickly interact with hundreds of certified APIs and accelerate your digital transformation projects.

Pre-requisites

Before using the Openapi CLI, you will need an account at Openapi® and an API key to the sandbox and/or production environment.

What you can do

With the Openapi CLI, you can easily interact with a variety of services in the Openapi Marketplace. For example, you can:

  • Send SMS messages with delivery reports and custom sender IDs
  • Process bills and payments in real time via API
  • Send electronic invoices securely to the Italian Revenue Agency
  • Generate PDFs from HTML content, including JavaScript rendering
  • Manage certified emails and legal communications via Italian Legalmail
  • Query company data, risk reports, automotive records, and more

For a complete list of all available services, check out the Openapi® Marketplace. There is also a small terminal easter egg available through openapi --who.

Installation

From crates.io

cargo install openapi-cli-rs

From source

git clone https://github.com/openapi/openapi-cli.git
cd openapi-cli
cargo install --path .

Or using make:

make install

The binary openapi will be installed in ~/.cargo/bin/.

Build without installing

cargo build --release

The binary will be available at target/release/openapi.

Configuration

The CLI uses two sets of environment variables depending on the type of command.

OAuth credentials (for token management)

Used by openapi oauth and openapi oauthv2 commands. These are your Openapi account credentials (Basic auth).

export OPENAPI_USERNAME="your-username"export OPENAPI_KEY="your-api-key"export OPENAPI_SANDBOX_KEY="your-sandbox-key"# optional

Bearer tokens (for service API commands)

Used by all service commands (smsv2, company, risk, etc.). These are tokens generated via openapi oauth create or openapi oauthv2 tokens create.

export OPENAPI_TOKEN="your-bearer-token"export OPENAPI_SANDBOX_TOKEN="your-sandbox-token"# optional

Verify your setup

openapi info

This shows all 5 environment variables, their status, and the scopes attached to your tokens.

Sandbox mode

Use the -S (or --sandbox) flag to run against sandbox environments:

openapi -S smsv2 send --to "+391234567890" --message "Test"
openapi -S oauth list

Token management

# List active tokens
openapi oauth list
# List all available scopes
openapi oauth scopes
# Create a new token
openapi oauth create --scopes "smsv2"# Check credit
openapi oauth credit
# Revoke a token
openapi oauth revoke --token "token-id"# OAuth v2 token creation
openapi oauthv2 tokens create --scopes "smsv2"# OAuth v2 scopes
openapi oauthv2 scopes list

Scope aliases

When creating tokens with openapi oauth create --scopes, you can use scope aliases instead of writing full scope strings.

How it works

Each API service is mapped to an alias name. When you use an alias, it automatically expands to all available scopes for that service.

AliasServiceDomain
allAll services(special keyword)
aiAI language modelsai.openapi.com
automotiveAutomotive dataautomotive.openapi.com
bollettiniBills paymentws.pagasubito.it
capZip codes and municipalitiescap.openapi.it
catastoItalian cadastral datacatasto.openapi.it
companyCompany datacompany.openapi.com
docuengineOfficial documentsdocuengine.openapi.com
domains.it domain managementdomains.altravia.com
esignatureElectronic signatureesignature.openapi.com
exchangeCurrency exchange ratesexchange.altravia.com
geocodingGeocodinggeocoding.openapi.it
invoiceElectronic invoicinginvoice.openapi.com
marchetemporaliTime stampingws.marchetemporali.com
oauthOAuth token managementoauth.openapi.it
oauthv2OAuth v2 token managementoauth.openapi.com
pecPEC / Legalmailpec.openapi.it
pecmassivaMassive REMws.pecmassiva.com
pdfHTML to PDFpdf.openapi.it
realestateReal estate valuationrealestate.openapi.com
riskRisk reports and scoringrisk.openapi.com
sdiSDI electronic invoicingsdi.openapi.it
smsv2SMS messagingsms.openapi.com
trustTrust verificationtrust.openapi.com
ufficiopostalePostal mailws.ufficiopostale.com
visengineOfficial documentsvisengine2.altravia.com
visurecameraliChamber of Commercevisurecamerali.openapi.it

Examples

# All SMS scopes
openapi oauth create --scopes "smsv2"# Multiple services
openapi oauth create --scopes "smsv2,company"# All available scopes (special keyword)
openapi oauth create --scopes "all"

Method filtering

Prefix an alias with an HTTP method to include only scopes for that method:

# Only POST scopes for SMS
openapi oauth create --scopes "post:smsv2"# Only GET scopes for company
openapi oauth create --scopes "get:company"# Mix methods and full aliases
openapi oauth create --scopes "post:smsv2,get:company,geocoding"

Supported method prefixes: GET, POST, PUT, PATCH, DELETE.

Case insensitive

Aliases and method prefixes are case insensitive:

openapi oauth create --scopes "SMSV2"
openapi oauth create --scopes "Post:SmsV2"
openapi oauth create --scopes "POST:SMSV2"

All of the above are equivalent.

Literal scopes

If a term does not match any alias, it is passed through as a literal scope:

openapi oauth create --scopes "smsv2,GET:imprese.openapi.it/base"

Available commands

CommandDescription
infoShow configuration status and readiness
oauthOAuth token management
aiAI language models
automotiveAutomotive data (vehicles, insurance)
bollettiniBills payment
capZip codes, municipalities, provinces, regions
catastoItalian cadastral data
companyCompany data and information
docuengineOfficial documents (Business Register, Revenue Agency, INPS)
domains.it domain management
esignatureElectronic signature
exchangeForeign currency exchange rates
geocodingGeocoding and reverse geocoding
invoiceElectronic invoicing
marchetemporaliDocument time stamping
pecItalian certified email (PEC / Legalmail)
pecmassivaMassive Registered Electronic Mail
pdfHTML to PDF conversion
realestateReal estate valuation data
riskRisk reports and scoring
sdiSDI electronic invoicing
smsv2SMS messaging (v2)
oauthv2OAuth v2 token management and analytics
trustTrust verification services
ufficiopostalePostal mail service
visengineOfficial documents (Chamber of Commerce, INPS, Tax Agency)
visurecameraliChamber of Commerce documents

Run openapi --help for the full list, or openapi <command> --help for subcommand details.

Development

# Build
make build
# Run tests
make test-commands
# Download/update OpenAPI specs
make oas-download

Contributing

Contributions are always welcome! Whether you want to report bugs, suggest new features, improve documentation, or contribute code, your help is appreciated.

Authors

Partners

Meet our partners using Openapi or contributing to this project:

Our Commitments

We believe in open source and we act on that belief. We became Silver Members of the Linux Foundation because we wanted to formally support the ecosystem we build on every day. Open standards, open collaboration, and open governance are part of how we work and how we think about software.

License

This project is licensed under the MIT License.

The MIT License is a permissive open-source license that allows you to freely use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the software, provided that the original copyright notice and this permission notice are included in all copies or substantial portions of the software.

For more details, see the full license text at the MIT License page.

About

🔐 A powerful, fully featured command-line interface and token manager for @openapi®

Topics

Resources

Code of conduct

Contributing

Stars

16 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages