# Request the compliance opinion from SAT

`POST https://api.fiscalisto.com/v1/issuers/{id}/compliance_opinion/refresh`

Requests it from SAT with the issuer's stored e.firma (POST /v1/issuers/{id}/efirma with keep_for_downloads: true); it arrives at GET /v1/issuers/{id}/compliance_opinion. 1 stamp in production, once every 10 minutes. It answers 202 as soon as it accepts it (status processing) and queries SAT in the background: sat_refresh.completed or sat_refresh.failed say how it ended, and so does GET /v1/sat_refreshes/{id}. Its stamp is set aside on accepting it (without stamps it answers 402 right away), used when SAT answers and returned if it doesn't. In test mode it gives a sample positive one instantly (the query already comes completed and sat_refresh.completed also arrives).

## Before you call

- **The issuer's stored e.firma** (in production; not needed in test mode): [`POST /v1/issuers/{id}/efirma`](https://fiscalisto.com/en/docs/api/referencia/emisores/sign-efirma) with `keep_for_downloads: true`. An RFC of your empresa uses the one stored in the app.

## Parameters

| Name | In | Required | Description |
| --- | --- | --- | --- |
| `id` | path | yes | The object's id. |
| `Idempotency-Key` | header |  | Optional (the SDKs send it on their own). If the response is lost, repeat the request with the same value within 24 hours: it answers the same, with idempotent-replayed: true, and doesn't do it twice (it doesn't create, send emails or charge). |

## With the TypeScript SDK

```ts
import { Fiscalisto } from "fiscalisto";

// La llave viene de FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const satRefresh = await fiscalisto.issuers.refreshComplianceOpinion("srf_7Hq2mXc9LpR4tVb8NzK1", { idempotencyKey: "pedido-A-1042" });
```

## With the Python SDK

```python
from fiscalisto import Fiscalisto

# La llave viene de FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

sat_refresh = fiscalisto.issuers.refresh_compliance_opinion("srf_7Hq2mXc9LpR4tVb8NzK1", idempotency_key="pedido-A-1042")
```

## With the PHP SDK

```php
<?php

use Fiscalisto\Fiscalisto;

// La llave viene de FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$satRefresh = $fiscalisto->issuers->refreshComplianceOpinion('srf_7Hq2mXc9LpR4tVb8NzK1', ['idempotency_key' => 'pedido-A-1042']);
```

## With the .NET SDK

```csharp
using Fiscalisto;

// La llave viene de FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var satRefresh = await fiscalisto.Issuers.RefreshComplianceOpinionAsync("srf_7Hq2mXc9LpR4tVb8NzK1", new RequestOptions { IdempotencyKey = "pedido-A-1042" });
```

## With the Go SDK

```go
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// La llave viene de FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	satRefresh, err := client.Issuers.RefreshComplianceOpinion(ctx, "srf_7Hq2mXc9LpR4tVb8NzK1", fiscalisto.WithIdempotencyKey("pedido-A-1042"))
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(satRefresh.ID)
}
```

## With the Java SDK

```java
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.RequestOptions;

// La llave viene de FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var satRefresh = fiscalisto.issuers().refreshComplianceOpinion("srf_7Hq2mXc9LpR4tVb8NzK1", RequestOptions.idempotencyKey("pedido-A-1042"));
System.out.println(satRefresh.getId());
```

## Response 202

OK.

A `SatRefresh` object:

| Field | Type | Always present | Description |
| --- | --- | --- | --- |
| `object` | `"sat_refresh"` | yes | What kind of object it is («invoice», «customer»…). |
| `id` | string | yes | The check's id (srf_…): GET /v1/sat_refreshes/{id} says how it is going. |
| `livemode` | boolean | yes | true in production (fk_live_ keys), false in test mode (fk_test_). Test objects aren't valid before the SAT. |
| `issuer` | string | yes | The issuer. |
| `document` | `declarations`, `compliance_opinion`, `tax_status_certificate`, `sat_mailbox` | yes | What was checked: declarations, compliance_opinion, tax_status_certificate or sat_mailbox. |
| `status` | `processing`, `completed`, `failed` | yes | processing (the SAT is being checked), completed (what it brought is in url) or failed (the SAT didn't answer: reason in error, the stamp came back). |
| `result` | object or null | yes | What it brought, with status completed: for declarations how many it listed and downloaded; for the rest, where to read the document. null while it continues or if it failed. |
| `result.found` | integer | yes | How many tax returns the SAT listed in the years checked. (from -9007199254740991 to 9007199254740991) |
| `result.downloaded` | integer | yes | How many files it downloaded. (from -9007199254740991 to 9007199254740991) |
| `result.pending` | integer | yes | How many tax returns still have files to download: they continue on their own within the next hour, with no extra stamp. (from -9007199254740991 to 9007199254740991) |
| `result.warning` | string or null | yes | If one part of the SAT failed (for example, the annual return), what it said; the rest was brought in. |
| `result.completes_at` | string (date-time) or null | yes | With pending: when the missing files and figures should be there. Meanwhile, GET /v1/sat_declarations already lists them, with figures_status pending. |
| `result.url` | string | yes | Where to read the document. |
| `error` | string or null | yes | With status failed: what the SAT said. null for the rest. |
| `charged` | boolean | yes | true when its stamp was used (the SAT answered). Always false in test mode: no stamps are used. |
| `timbre_held` | boolean | yes | true while it continues: its stamp is set aside (GET /v1/balance no longer counts it) and comes back if the SAT doesn't answer. |
| `created_at` | string (date-time) | yes | When it was requested. |
| `completed_at` | string (date-time) or null | yes | When it finished (completed or failed). null while it continues. |
| `refreshed_at` | string (date-time) | yes | When it was requested (same as created_at). |
| `next_refresh_at` | string (date-time) | yes | From when it can be requested again for the same issuer (10 minutes later). |
| `url` | string | yes | Where to read what it brought. |

```json
{
  "object": "sat_refresh",
  "id": "srf_7Hq2mXc9LpR4tVb8NzK1",
  "livemode": true,
  "issuer": "iss_OufpKqnrvx9p",
  "document": "compliance_opinion",
  "status": "processing",
  "result": null,
  "error": null,
  "charged": false,
  "timbre_held": true,
  "created_at": "2026-10-27T09:12:00-06:00",
  "completed_at": null,
  "refreshed_at": "2026-10-27T09:12:00-06:00",
  "next_refresh_at": "2026-10-27T09:22:00-06:00",
  "url": "/v1/issuers/iss_OufpKqnrvx9p/compliance_opinion"
}
```

## Errors

- `daily_limit` (429): You reached today's limit of something not paid with stamps. Retry-After says how many seconds until midnight in Mexico City.
- `efirma_required` (400): To download an issuer's invoices from the SAT in live mode, keep its e.firma first: POST /v1/issuers/{id}/efirma with keep_for_downloads: true (also when the kept one expired).
- `feature_not_in_plan` (403): Live, this part of the API (inventario, portal de proveedores, pedidos, comprobación de gastos) follows the empresa's plan, as in the app: it comes with Operaciones (added to any paid plan; included in Corporativo). The books (the /v1/accounting routes except DIOT, cross checks, IVA refunds and fixed assets) come with Contabilidad (added to Independiente, Emprendedor or Negocio; included in Despacho and Corporativo): without it, changing the books answers this error, and reading them works only up to the last month it had it. Add either in Ajustes › Plan y pagos; test mode has everything.
- `insufficient_balance` (402): The account has no live stamps left: to stamp, check RFCs against SAT's lists, look up constancias, request SAT downloads or fetch declarations, the compliance opinion or the mailbox from SAT. Buy a pack in Desarrolladores › Timbres y pagos, or turn on auto-recharge. Never happens in test mode.
- `issuer_archived` (400): The issuer is archived and no longer stamps. Its documents can still be read and canceled.
- `issuer_linked_empresa` (403): That issuer is an empresa of the app connected to your account: through the API it only offers its Portal de proveedores (/v1/portal_suppliers and /v1/supplier_invoices) and, once someone who may pay suppliers and change Configurar pagos turned them on, its supplier payouts (/v1/payouts and /v1/payroll_payouts). It also stops when whoever connected it (or turned its payouts on) no longer has that permission in the empresa: message_es says which. Do everything else in the app.
- `issuer_missing` (404): There is no such issuer in the account (or it belongs to the other mode).
- `issuer_not_allowed` (403): This key can't use that issuer.
- `issuer_required` (400): The account has several issuers and the request doesn't say which: send `issuer` (iss_…).
- `livemode_mismatch` (400): The object belongs to the other mode: an fk_test_ key only sees test data and an fk_live_ key only live data.
- `resource_missing` (404): There's no object with that id (or it belongs to another issuer or the other mode).
- `sat_refresh_too_soon` (429): This issuer's tax returns were looked up at SAT less than 10 minutes ago. Retry-After says how many seconds are left; what came is in GET /v1/sat_declarations.
- `sat_unavailable` (502): SAT didn't answer or didn't let the issuer's e.firma in. No stamp was used. Retry in 10 minutes.

Plus those of any call (key, fields, limits): https://fiscalisto.com/en/docs/api/errores.md.
