Getting started
Create a key, make your first call, read the answer, make the next
one. You need a Myle account and a terminal with curl.
1. Create a key
Myle has two kinds of key (details in Authentication). For an integration that runs on its own, a server or a nightly job, create an organization key: it acts as its own robot account and keeps working when the person who created it leaves the organization.
- Sign in to Myle on the web, app.myleapp.fr, and open the organization the integration will work in.
-
In the organization's settings, open “Clés d'API” (API keys).
You need the right
API_KEYS_MANAGE; if the screen is not there, ask a member who manages the organization. - Create a key and give it a name that says what uses it, for example “Export comptable Sage”. The name is shown as the author of everything the key writes.
-
Choose what the key may do, with the same editor as for members: a
role, rights, and a tag scope if needed. Give it only what the
integration needs; for this guide,
ARTICLES_LIST(see the products). You can only give rights you hold yourself. - Choose when it expires: 30 days, 90 days, 1 year (the default) or never.
- Confirm with your passkey: Myle asks for it before creating a key.
- Copy the token. It is shown once: Myle keeps only a hash of it. If you lose it, rotate the key to get a new one.
To try the API with your own rights instead, create a user key in “Mon compte”, under “Mes clés d'API”. It acts as you, in your organizations.
Keep the token in your server's secrets, here an environment variable:
CLI
#!/usr/bin/env bash
# getting-started-env-key: the myle CLI (key from `myle login` or MYLE_API_KEY).
# The CLI reads MYLE_API_KEY too; or store the key once for the project, read on stdin without echo.
myle login --interactive
Shell
export MYLE_API_KEY='myleOrganizationKey_01JD3QF8Z6K4W1Y9X2T5C7N3BA_4fT9q…_k2P9xQ'
A key is a password. Never put it in a web page, a mobile app, a URL or a repository: call the API from your server.
2. First call: who am I?
CLI
#!/usr/bin/env bash
# getting-started-whoami: the myle CLI (key from `myle login` or MYLE_API_KEY).
# The CLI sends Myle-Client: cli/<version>; -H names your integration and its version instead.
myle me -H 'Myle-Client: my-export/1.0.0' | jq -r '[.id, .email, .firstName] | @tsv'
HTTP (curl)
curl https://api.myleapp.fr/me \
-H "Authorization: Bearer $MYLE_API_KEY" \
-H "Myle-Client: my-export/1.0.0"
TypeScript
import { Myle } from '@myleapp/myle';
// The key comes from MYLE_API_KEY. myleClient (optional) names your integration and its version.
const myle = new Myle({ myleClient: 'my-export/1.0.0' });
const me = await myle.me.get();
console.log(me.id, me.email, me.firstName);
Python
from myle import Myle
# The key comes from MYLE_API_KEY. myle_client (optional) names your integration and its version.
myle = Myle(myle_client="my-export/1.0.0")
me = myle.me.get()
print(me.id, me.email, me.first_name)
Go
package main
import (
"context"
"fmt"
"log"
myle "github.com/myleapp/myle-go"
)
func main() {
// The key comes from MYLE_API_KEY. WithMyleClient (optional) names your integration and its version.
client := myle.NewClient(myle.WithMyleClient("my-export/1.0.0"))
me, err := client.Me.Get(context.Background())
if err != nil {
log.Fatal(err)
}
fmt.Println(me.ID, me.Email, me.FirstName)
}
Java
import fr.myleapp.myle.MyleClient;
import fr.myleapp.myle.User;
public class Example {
public static void main(String[] args) {
// The key comes from MYLE_API_KEY. myleClient (optional) names your integration and its version.
MyleClient client = MyleClient.builder().myleClient("my-export/1.0.0").build();
User me = client.me().get();
System.out.println(me.id() + " " + me.email() + " " + me.firstName());
}
}
Scala
import fr.myleapp.myle.{MyleClient, MyleConfig}
object GettingStartedWhoami {
def main(args: Array[String]): Unit = {
// The key comes from MYLE_API_KEY. myleClient (optional) names your integration and its version.
val myle = MyleClient(MyleConfig(myleClient = Some("my-export/1.0.0")))
val me = myle.me.get()
println(s"${me.id} ${me.email} ${me.firstName}")
}
}
PHP
<?php
require __DIR__ . '/vendor/autoload.php';
use Myle\Client;
// The key comes from MYLE_API_KEY. myleClient (optional) names your integration and its version.
$myle = new Client(myleClient: 'my-export/1.0.0');
$me = $myle->me->get();
echo $me->id, ' ', $me->email, ' ', $me->firstName, "\n";
C#
using Myle;
// The key comes from MYLE_API_KEY. MyleClientHeader (optional) names your integration and its version.
using var client = new MyleClient(new MyleClientOptions { MyleClientHeader = "my-export/1.0.0" });
var me = await client.Me.GetAsync();
Console.WriteLine($"{me.Id} {me.Email} {me.FirstName}");
Myle-Client is optional: it names your integration and
its version, so its calls can be told apart in Myle's usage
statistics.
3. The response
HTTP
HTTP/1.1 200 OK
Content-Type: application/json
Myle-Request-Id: 01M803CAJ14DSK72C4MKMWBPT7
RateLimit-Policy: "read";q=600;w=60
RateLimit: "read";r=599;t=60
{
"id": "user_5b1e9c2a-…",
"object": "user",
"email": "apikey-01JD3QF8…@robots.myleapp.invalid",
"firstName": "Export comptable Sage",
"lastName": "",
"createdAt": "2026-11-21T09:14:03Z"
}
-
With an organization key,
/meis the key's robot account: its name is the key's name, its address is never routable. With a user key, it is you. -
Every resource carries its
id, prefixed by its kind (user_…), andobject, the same kind spelled out. Keys are camelCase; instants are RFC 3339 in UTC. See Conventions. -
Myle-Request-Ididentifies the request in Myle's logs: quote it when you write to support. -
RateLimit-PolicyandRateLimitsay which quota was counted (read: 600 requests a minute) and what remains. See Rate limits.
4. The next call: your organization and its products
Every operation on an organization's data lives under
/organizations/{id}. The organization's id is in the
address bar when you use Myle on the web:
app.myleapp.fr/organisations/organisation_7f2c41d0-…/….
The API accepts that spelling and answers with the American one,
organization_7f2c41d0-….
CLI
#!/usr/bin/env bash
# getting-started-organization: the myle CLI (key from `myle login` or MYLE_API_KEY).
myle organizations retrieve organization_7f2c41d0-8a3b-4c6e-9f12-5d7e8a9b0c1d \
| jq -r '[.name, .siren, .vatNumber] | @tsv'
HTTP (curl)
curl https://api.myleapp.fr/organizations/organization_7f2c41d0-8a3b-4c6e-9f12-5d7e8a9b0c1d \
-H "Authorization: Bearer $MYLE_API_KEY"
TypeScript
import { Myle } from '@myleapp/myle';
const myle = new Myle();
// organization(id) sends nothing: it scopes the calls made through it.
const organization = await myle.organization('organization_7f2c41d0-8a3b-4c6e-9f12-5d7e8a9b0c1d').get();
console.log(organization.name, organization.siren, organization.vatNumber);
Python
from myle import Myle
myle = Myle()
# organization(id) sends nothing: it scopes the calls made through it.
organization = myle.organization("organization_7f2c41d0-8a3b-4c6e-9f12-5d7e8a9b0c1d").get()
print(organization.name, organization.siren, organization.vat_number)
Go
package main
import (
"context"
"fmt"
"log"
myle "github.com/myleapp/myle-go"
)
func main() {
client := myle.NewClient()
// Organization(id) sends nothing: it scopes the calls made through it.
organization, err := client.Organization("organization_7f2c41d0-8a3b-4c6e-9f12-5d7e8a9b0c1d").Get(context.Background())
if err != nil {
log.Fatal(err)
}
fmt.Println(organization.Name, text(organization.Siren), text(organization.VatNumber))
}
// text is a member that may be null (a pointer) as text: "" for null.
func text(s *string) string {
if s == nil {
return ""
}
return *s
}
Java
import fr.myleapp.myle.MyleClient;
import fr.myleapp.myle.Organization;
public class Example {
public static void main(String[] args) {
MyleClient client = MyleClient.builder().build();
// organization(id) sends nothing: it scopes the calls made through it.
Organization organization = client.organization("organization_7f2c41d0-8a3b-4c6e-9f12-5d7e8a9b0c1d").get();
System.out.println(organization.name() + " " + organization.siren() + " " + organization.vatNumber());
}
}
Scala
import fr.myleapp.myle.MyleClient
object GettingStartedOrganization {
def main(args: Array[String]): Unit = {
val myle = MyleClient()
// organization(id) sends nothing: it scopes the calls made through it.
val organization = myle.organization("organization_7f2c41d0-8a3b-4c6e-9f12-5d7e8a9b0c1d").get()
println(s"${organization.name} ${organization.siren.getOrElse("")} ${organization.vatNumber.getOrElse("")}")
}
}
PHP
<?php
require __DIR__ . '/vendor/autoload.php';
use Myle\Client;
$myle = new Client();
// organization(id) sends nothing: it scopes the calls made through it.
$organization = $myle->organization('organization_7f2c41d0-8a3b-4c6e-9f12-5d7e8a9b0c1d')->get();
echo $organization->name, ' ', $organization->siren, ' ', $organization->vatNumber, "\n";
C#
using Myle;
using var client = new MyleClient();
// Organization(id) sends nothing: it scopes the calls made through it.
var organization = await client.Organization("organization_7f2c41d0-8a3b-4c6e-9f12-5d7e8a9b0c1d").GetAsync();
Console.WriteLine($"{organization.Name} {organization.Siren} {organization.VatNumber}");
JSON
{
"id": "organization_7f2c41d0-…",
"object": "organization",
"name": "SARL Les Prés Verts",
"siren": "123456789",
"vatNumber": "FR12123456789",
"createdAt": "2024-02-12T08:30:00Z",
"updatedAt": "2026-10-03T15:12:40Z"
}
Then the catalog, two products at a time:
CLI
#!/usr/bin/env bash
# getting-started-products-page: the myle CLI (key from `myle login` or MYLE_API_KEY).
# One page of two; --all follows every page.
page=$(myle products list --organization organization_7f2c41d0-8a3b-4c6e-9f12-5d7e8a9b0c1d --limit 2)
jq -r '.data[] | [.number, .name, .unitPrice.amount] | @tsv' <<<"$page"
jq -r 'if .nextCursor then "more pages follow" else "last page" end' <<<"$page"
HTTP (curl)
curl "https://api.myleapp.fr/organizations/organization_7f2c41d0-8a3b-4c6e-9f12-5d7e8a9b0c1d/products?limit=2" \
-H "Authorization: Bearer $MYLE_API_KEY"
TypeScript
import { Myle } from '@myleapp/myle';
const myle = new Myle();
const products = myle.organization('organization_7f2c41d0-8a3b-4c6e-9f12-5d7e8a9b0c1d').products;
// One page of two; iterate list() itself to follow every page.
const page = await products.list({ limit: 2 }).firstPage();
for (const product of page.data) {
console.log(product.number, product.name, product.unitPrice?.amount);
}
console.log(page.hasMore ? 'more pages follow' : 'last page');
Python
from myle import Myle
myle = Myle()
products = myle.organization("organization_7f2c41d0-8a3b-4c6e-9f12-5d7e8a9b0c1d").products
# One page of two; iterate list() itself to follow every page.
page = products.list(limit=2).first_page()
for product in page.data:
print(product.number, product.name, product.unit_price.amount if product.unit_price else None)
print("more pages follow" if page.has_more else "last page")
Go
package main
import (
"context"
"fmt"
"log"
myle "github.com/myleapp/myle-go"
)
func main() {
client := myle.NewClient()
products := client.Organization("organization_7f2c41d0-8a3b-4c6e-9f12-5d7e8a9b0c1d").Products
// One page of two; range over List(…).All() to follow every page.
page, err := products.List(context.Background(), &myle.ProductListParams{Limit: myle.Int(2)}).FirstPage()
if err != nil {
log.Fatal(err)
}
for _, product := range page.Data {
price := ""
if product.UnitPrice != nil {
price = product.UnitPrice.Amount
}
fmt.Println(product.Number, product.Name, price)
}
if page.HasMore() {
fmt.Println("more pages follow")
} else {
fmt.Println("last page")
}
}
Java
import fr.myleapp.myle.MyleClient;
import fr.myleapp.myle.Page;
import fr.myleapp.myle.Product;
import fr.myleapp.myle.ProductListParams;
import fr.myleapp.myle.Products;
public class Example {
public static void main(String[] args) {
MyleClient client = MyleClient.builder().build();
Products products = client.organization("organization_7f2c41d0-8a3b-4c6e-9f12-5d7e8a9b0c1d").products();
// One page of two; iterate list() itself to follow every page.
Page<Product> page = products.list(ProductListParams.builder().limit(2).build()).firstPage();
for (Product product : page.data()) {
String amount = product.unitPrice() != null ? product.unitPrice().amount() : null;
System.out.println(product.number() + " " + product.name() + " " + amount);
}
System.out.println(page.hasMore() ? "more pages follow" : "last page");
}
}
Scala
import fr.myleapp.myle.MyleClient
import fr.myleapp.myle.models.ListProductsParams
object GettingStartedProductsPage {
def main(args: Array[String]): Unit = {
val myle = MyleClient()
val products = myle.organization("organization_7f2c41d0-8a3b-4c6e-9f12-5d7e8a9b0c1d").products
// One page of two; iterate list() itself to follow every page.
val page = products.list(ListProductsParams(limit = Some(2))).firstPage()
for (product <- page.data) {
println(s"${product.number} ${product.name} ${product.unitPrice.map(_.amount).getOrElse("")}")
}
println(if (page.hasMore) "more pages follow" else "last page")
}
}
PHP
<?php
require __DIR__ . '/vendor/autoload.php';
use Myle\Client;
$myle = new Client();
$products = $myle->organization('organization_7f2c41d0-8a3b-4c6e-9f12-5d7e8a9b0c1d')->products;
// One page of two; iterate list() itself to follow every page.
$page = $products->list(limit: 2)->firstPage();
foreach ($page->data as $product) {
echo $product->number, ' ', $product->name, ' ', $product->unitPrice?->amount, "\n";
}
echo $page->hasMore() ? 'more pages follow' : 'last page', "\n";
C#
using Myle;
using var client = new MyleClient();
var products = client.Organization("organization_7f2c41d0-8a3b-4c6e-9f12-5d7e8a9b0c1d").Products;
// One page of two; await foreach over ListAsync itself to follow every page.
var page = await products.ListAsync(new ProductListParams { Limit = 2 }).FirstPageAsync();
foreach (var product in page.Data)
{
Console.WriteLine($"{product.Number} {product.Name} {product.UnitPrice?.Amount}");
}
Console.WriteLine(page.HasMore ? "more pages follow" : "last page");
JSON
{
"data": [
{
"id": "product_2ab4c6e8-…",
"object": "product",
"number": "A0012",
"name": "Ensilage maïs",
"status": "ACTIVE",
"unitPrice": { "amount": "45.00", "currency": "EUR" },
"costPrice": null,
"vatRate": "20",
"accountingNumber": "706000",
"barcodes": [],
"tags": ["Prestations"],
"createdAt": "2026-03-02T10:21:44Z",
"updatedAt": "2026-10-18T07:55:02Z"
},
{ "id": "product_9d0f…", "object": "product", "…": "…" }
],
"nextCursor": "eyJrIjoi…"
}
Amounts are decimal strings, never numbers. To get the next page,
send nextCursor back as cursor; the last
page has no cursor. See
Pagination.
If the reference does not list an operation yet, it is not released: its shape may still change.
5. When something goes wrong
Without the Authorization header:
HTTP
HTTP/1.1 401 Unauthorized
Content-Type: application/json
Content-Language: en
WWW-Authenticate: Bearer realm="myle"
Myle-Request-Id: 01M803DQ7T5XK2W9H4NB8RZC3E
{
"code": "auth.credential.missing",
"context": {},
"error": "Authentication required.",
"request_id": "01M803DQ7T5XK2W9H4NB8RZC3E"
}
Your program branches on code; error is for
a person, in English by default or in French with
Accept-Language: fr. Without the right
ARTICLES_LIST, the products answer
403 auth.right.missing with
{"right": "ARTICLES_LIST"}. See
Errors.