curl --request POST \
--url https://api.newinvoice.dev/v1/fiscal_profiles/{id}/sync \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"sync_from": "string",
"max_monthly_documents": 1,
"phone": "string"
}
'import requests
url = "https://api.newinvoice.dev/v1/fiscal_profiles/{id}/sync"
payload = {
"sync_from": "string",
"max_monthly_documents": 1,
"phone": "string"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({sync_from: 'string', max_monthly_documents: 1, phone: 'string'})
};
fetch('https://api.newinvoice.dev/v1/fiscal_profiles/{id}/sync', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.newinvoice.dev/v1/fiscal_profiles/{id}/sync",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'sync_from' => 'string',
'max_monthly_documents' => 1,
'phone' => 'string'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.newinvoice.dev/v1/fiscal_profiles/{id}/sync"
payload := strings.NewReader("{\n \"sync_from\": \"string\",\n \"max_monthly_documents\": 1,\n \"phone\": \"string\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.newinvoice.dev/v1/fiscal_profiles/{id}/sync")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"sync_from\": \"string\",\n \"max_monthly_documents\": 1,\n \"phone\": \"string\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.newinvoice.dev/v1/fiscal_profiles/{id}/sync")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sync_from\": \"string\",\n \"max_monthly_documents\": 1,\n \"phone\": \"string\"\n}"
response = http.request(request)
puts response.read_body{
"object": "fiscal_profile_sync",
"fiscal_profile_id": "fp_2P9K3sample",
"rfc": "XAXX010101000",
"enabled": true,
"status": "inactive",
"sync_from": "string",
"synced_through": "string",
"lag_days": -9007199254740991,
"documents": 0,
"checked_at": "2026-07-10T18:25:43Z"
}{
"type": "https://errors.invoiceapi.mx/auth_unauthorized",
"title": "Authentication required",
"status": 401,
"code": "auth.unauthorized",
"detail": "Missing or invalid API key.",
"remediation": "Send `Authorization: Bearer sk_test_...` (or sk_live_...) with a valid API key.",
"doc_url": "/docs/errors#auth-unauthorized",
"request_id": "req_2P9K3sample"
}{
"type": "https://errors.invoiceapi.mx/resource_not_found",
"title": "Resource not found",
"status": 404,
"code": "resource.not_found",
"detail": "No such id in this org + mode.",
"remediation": "Verify the id and that the key mode (test/live) matches the id.",
"doc_url": "/docs/errors#resource-not_found",
"request_id": "req_2P9K3sample"
}{
"type": "https://errors.invoiceapi.mx/fiscal_profile_in_use",
"title": "Fiscal profile is in use",
"status": 409,
"code": "fiscal_profile.in_use",
"detail": "The profile is referenced by issued invoices.",
"remediation": "Profiles with invoices are retained; rotate the CSD instead of deleting.",
"doc_url": "/docs/errors#fiscal_profile-in_use",
"request_id": "req_2P9K3sample"
}{
"type": "https://errors.invoiceapi.mx/fiscal_profile_invalid_csd",
"title": "Invalid CSD certificate or password",
"status": 422,
"code": "fiscal_profile.invalid_csd",
"detail": "The CSD .cer/.key pair could not be opened.",
"remediation": "Verify cer_base64 is the .cer, key_base64 is the .key, and the password.",
"doc_url": "/docs/errors#fiscal_profile-invalid_csd",
"request_id": "req_2P9K3sample"
}{
"type": "https://errors.invoiceapi.mx/rate_limit_exceeded",
"title": "Rate limit exceeded",
"status": 429,
"code": "rate_limit.exceeded",
"detail": "Too many requests for this key + request class (reads and writes are limited separately).",
"remediation": "Back off and retry after the number of seconds in the Retry-After header; batch work or lower your request rate.",
"doc_url": "/docs/errors#rate_limit-exceeded",
"request_id": "req_2P9K3sample"
}{
"type": "https://errors.invoiceapi.mx/internal_error",
"title": "Internal server error",
"status": 500,
"code": "internal.error",
"detail": "An unexpected error occurred.",
"remediation": "Retry later; contact support with the request_id if it persists.",
"doc_url": "/docs/errors#internal-error",
"request_id": "req_2P9K3sample"
}Enable automatic SAT synchronization
Register this profile’s RFC for automatic SAT synchronization. We backfill the taxpayer’s CFDI history (up to the SAT’s 71-month limit) and then keep it current, mirroring both issued and received CFDIs. Authorizes with the FIEL (e.firma), not the CSD. Idempotent: re-enabling an already-registered RFC is a no-op. Expect synced_through to trail today by 1-3 days — the SAT does not publish a CFDI for bulk download until ~24-72h after it is issued.
curl --request POST \
--url https://api.newinvoice.dev/v1/fiscal_profiles/{id}/sync \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"sync_from": "string",
"max_monthly_documents": 1,
"phone": "string"
}
'import requests
url = "https://api.newinvoice.dev/v1/fiscal_profiles/{id}/sync"
payload = {
"sync_from": "string",
"max_monthly_documents": 1,
"phone": "string"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({sync_from: 'string', max_monthly_documents: 1, phone: 'string'})
};
fetch('https://api.newinvoice.dev/v1/fiscal_profiles/{id}/sync', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.newinvoice.dev/v1/fiscal_profiles/{id}/sync",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'sync_from' => 'string',
'max_monthly_documents' => 1,
'phone' => 'string'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.newinvoice.dev/v1/fiscal_profiles/{id}/sync"
payload := strings.NewReader("{\n \"sync_from\": \"string\",\n \"max_monthly_documents\": 1,\n \"phone\": \"string\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.newinvoice.dev/v1/fiscal_profiles/{id}/sync")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"sync_from\": \"string\",\n \"max_monthly_documents\": 1,\n \"phone\": \"string\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.newinvoice.dev/v1/fiscal_profiles/{id}/sync")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sync_from\": \"string\",\n \"max_monthly_documents\": 1,\n \"phone\": \"string\"\n}"
response = http.request(request)
puts response.read_body{
"object": "fiscal_profile_sync",
"fiscal_profile_id": "fp_2P9K3sample",
"rfc": "XAXX010101000",
"enabled": true,
"status": "inactive",
"sync_from": "string",
"synced_through": "string",
"lag_days": -9007199254740991,
"documents": 0,
"checked_at": "2026-07-10T18:25:43Z"
}{
"type": "https://errors.invoiceapi.mx/auth_unauthorized",
"title": "Authentication required",
"status": 401,
"code": "auth.unauthorized",
"detail": "Missing or invalid API key.",
"remediation": "Send `Authorization: Bearer sk_test_...` (or sk_live_...) with a valid API key.",
"doc_url": "/docs/errors#auth-unauthorized",
"request_id": "req_2P9K3sample"
}{
"type": "https://errors.invoiceapi.mx/resource_not_found",
"title": "Resource not found",
"status": 404,
"code": "resource.not_found",
"detail": "No such id in this org + mode.",
"remediation": "Verify the id and that the key mode (test/live) matches the id.",
"doc_url": "/docs/errors#resource-not_found",
"request_id": "req_2P9K3sample"
}{
"type": "https://errors.invoiceapi.mx/fiscal_profile_in_use",
"title": "Fiscal profile is in use",
"status": 409,
"code": "fiscal_profile.in_use",
"detail": "The profile is referenced by issued invoices.",
"remediation": "Profiles with invoices are retained; rotate the CSD instead of deleting.",
"doc_url": "/docs/errors#fiscal_profile-in_use",
"request_id": "req_2P9K3sample"
}{
"type": "https://errors.invoiceapi.mx/fiscal_profile_invalid_csd",
"title": "Invalid CSD certificate or password",
"status": 422,
"code": "fiscal_profile.invalid_csd",
"detail": "The CSD .cer/.key pair could not be opened.",
"remediation": "Verify cer_base64 is the .cer, key_base64 is the .key, and the password.",
"doc_url": "/docs/errors#fiscal_profile-invalid_csd",
"request_id": "req_2P9K3sample"
}{
"type": "https://errors.invoiceapi.mx/rate_limit_exceeded",
"title": "Rate limit exceeded",
"status": 429,
"code": "rate_limit.exceeded",
"detail": "Too many requests for this key + request class (reads and writes are limited separately).",
"remediation": "Back off and retry after the number of seconds in the Retry-After header; batch work or lower your request rate.",
"doc_url": "/docs/errors#rate_limit-exceeded",
"request_id": "req_2P9K3sample"
}{
"type": "https://errors.invoiceapi.mx/internal_error",
"title": "Internal server error",
"status": 500,
"code": "internal.error",
"detail": "An unexpected error occurred.",
"remediation": "Retry later; contact support with the request_id if it persists.",
"doc_url": "/docs/errors#internal-error",
"request_id": "req_2P9K3sample"
}Authorizations
API key: Authorization: Bearer sk_test_... or sk_live_....
Headers
Pin a dated API release (Stripe-style). Omit to use the current version. An unknown value returns 400 request.invalid_version. Echoed back on every response.
"2026-07-10"
Connect: act on behalf of one of your connected accounts (its acct_…/org_… id). Omit to act as your own organization. Not honored on /v1/api_keys.
"org_2P9connectedacct"
Safely retry any POST. The first response is stored for 24h and replayed byte-for-byte for identical retries (the replay adds an idempotent-replayed: true header). Reusing the key with a different body is 409 idempotency.key_reuse; an in-flight duplicate is 409 idempotency.key_processing. This makes retrying a 502/429 safe — no duplicate stamp.
"a1b2c3d4-e5f6-4789-8abc-1234567890ab"
Path Parameters
Fiscal profile id, e.g. fp_3k9.
Body
How far back to backfill, yyyy-mm-dd. Clamped to the SAT limit (71 months back, floored to the 1st of that month). Defaults to the maximum history available.
^\d{4}-\d{2}-\d{2}$Approximate CFDIs this taxpayer issues+receives per month. Used to size the SAT fetch chunks — set it realistically; a wrong estimate makes the backfill chunk badly.
x <= 1000000Notification phone in international format, e.g. "+5215512345678".
20Response
Default Response
fiscal_profile_sync Whether automatic SAT synchronization is turned on.
healthy = the watermark is advancing. stalled = it has stopped moving; the upstream sync died and we are repairing it. pending = registered, first sync not yet observed.
inactive, pending, healthy, stalled Start of the historical backfill, yyyy-mm-dd.
We have your CFDIs up to and including this date (yyyy-mm-dd). Expect this to trail today by 1-3 days: the SAT itself does not publish a CFDI for bulk download until ~24-72h after it is issued.
Days between synced_through and today. 1-3 is the healthy steady state.
-9007199254740991 <= x <= 9007199254740991CFDIs mirrored for this profile so far.
0 <= x <= 9007199254740991