Skip to content

Commit 4b11829

Browse files
Updated at mer 11 feb 2026, 16:44:20, CET
1 parent 1ff369f commit 4b11829

1 file changed

Lines changed: 194 additions & 0 deletions

File tree

docs/crates-io.md

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
# Openapi® CLI
2+
3+
The official command-line interface to interact with **Openapi® APIs** directly from your terminal.
4+
5+
`openapi` provides structured access to the Openapi Marketplace, including OAuth token management, scope aliases, sandbox support, and service-specific commands.
6+
7+
8+
## Overview
9+
10+
Openapi® CLI allows you to:
11+
12+
* Authenticate and manage OAuth tokens
13+
* Call Openapi® services from the terminal
14+
* Automate workflows in scripts and CI/CD pipelines
15+
* Work with sandbox and production environments
16+
* Use scope aliases for simplified token creation
17+
18+
It is designed to be predictable, script-friendly, and consistent across services.
19+
20+
21+
## Pre-requisites
22+
23+
Before using the CLI, you need:
24+
25+
* An active account at [https://console.openapi.com/](https://console.openapi.com/)
26+
* An API key for sandbox and/or production
27+
* Valid credentials configured via environment variables
28+
29+
30+
## Installation
31+
32+
Install from crates.io:
33+
34+
```bash
35+
cargo install openapi-cli
36+
```
37+
38+
Or add it to your project:
39+
40+
```bash
41+
cargo add openapi-cli
42+
```
43+
44+
45+
## Configuration
46+
47+
The CLI relies on environment variables. There are two credential types depending on the command.
48+
49+
50+
### 1️⃣ OAuth Credentials (Token Management)
51+
52+
Used by `openapi token` commands.
53+
54+
```bash
55+
export OPENAPI_USERNAME="your-username"
56+
export OPENAPI_KEY="your-api-key"
57+
export OPENAPI_SANDBOX_KEY="your-sandbox-key" # optional
58+
```
59+
60+
These credentials are used for Basic authentication when creating or managing tokens.
61+
62+
63+
### 2️⃣ Bearer Tokens (Service Commands)
64+
65+
Used by service commands like `sms`, `company`, `risk`, etc.
66+
67+
```bash
68+
export OPENAPI_TOKEN="your-bearer-token"
69+
export OPENAPI_SANDBOX_TOKEN="your-sandbox-token" # optional
70+
```
71+
72+
Tokens are generated using:
73+
74+
```bash
75+
openapi token create --scopes "sms"
76+
```
77+
78+
79+
## Verify Configuration
80+
81+
To check your environment setup:
82+
83+
```bash
84+
openapi info
85+
```
86+
87+
This displays:
88+
89+
* All required environment variables
90+
* Their configured status
91+
* Token scopes (if available)
92+
93+
94+
## Sandbox Mode
95+
96+
Use `-S` or `--sandbox` to target sandbox environments:
97+
98+
```bash
99+
openapi -S sms send --to "+391234567890" --message "Test"
100+
openapi -S token list
101+
```
102+
103+
104+
## Token Management
105+
106+
```bash
107+
# List active tokens
108+
openapi token list
109+
110+
# List all available scopes
111+
openapi token scopes
112+
113+
# Create a new token
114+
openapi token create --scopes "sms,company"
115+
116+
# Filter by HTTP method
117+
openapi token create --scopes "post:sms,get:company"
118+
119+
# Check credit
120+
openapi token credit
121+
122+
# Revoke a token
123+
openapi token revoke --token "token-id"
124+
```
125+
126+
Supported HTTP method filters:
127+
128+
`GET`, `POST`, `PUT`, `PATCH`, `DELETE`
129+
130+
Aliases and method prefixes are case insensitive.
131+
132+
If a scope does not match an alias, it is passed through as a literal scope.
133+
134+
135+
## Available Services
136+
137+
The CLI provides commands for services including:
138+
139+
* `ai`
140+
* `automotive`
141+
* `cadastre`
142+
* `certified-email`
143+
* `chamber-of-commerce`
144+
* `company`
145+
* `docuengine`
146+
* `domains`
147+
* `esignature`
148+
* `exchange-rate`
149+
* `geocoding`
150+
* `invoice`
151+
* `massive-rem`
152+
* `paying-bills`
153+
* `pdf`
154+
* `postal-service`
155+
* `real-estate`
156+
* `risk`
157+
* `sdi`
158+
* `sms`
159+
* `time-stamping`
160+
* `trust`
161+
* `visengine`
162+
* `zip-codes`
163+
164+
Run:
165+
166+
```bash
167+
openapi --help
168+
```
169+
170+
or
171+
172+
```bash
173+
openapi <command> --help
174+
```
175+
176+
for full command details.
177+
178+
179+
## Design Principles
180+
181+
* Explicit over implicit
182+
* Predictable command structure
183+
* Script-friendly output
184+
* Consistent behavior across services
185+
* Environment-based configuration
186+
187+
188+
## License
189+
190+
MIT License.
191+
192+
---
193+
194+
Openapi® CLI — bringing Openapi® to your terminal.

0 commit comments

Comments
 (0)