API Docs
CA
Referència

Referència d’endpoints

Contracte HTTP exacte: paràmetres, cossos, exemples de resposta, capçaleres i errors.

post/v1/reports

Crear un informe d’anàlisi

Valida i posa un text a la cua. La resposta 202 inclou recursos d’estat i d’esdeveniments; no implica que l’anàlisi hagi acabat.

Authorization: Bearer ARTEXT_API_KEY

Parameters

Idempotency-Keyheader

Recommended unique key for safely retrying this creation request. It is scoped to the authenticated caller, retained for 24 hours, and must not be reused with a different payload.

Request body

application/json
{
  "$ref": "#/components/schemas/ReportRequest"
}

Create a report

{
  "domain_slug": "llenguatge-clar",
  "external_id": "document-123",
  "language": "ca",
  "text": "En el dia d\u2019avui es dur\u00e0 a terme la revisi\u00f3 de la sol\u00b7licitud.",
  "text_type_slug": "text-juridic-administratiu-dirigit-a-la-ciutadania"
}

Responses

202Successful Response
LocationCanonical status resource for the accepted report.Retry-AfterMinimum number of seconds before the first status poll.X-Request-IDIdentifier to retain for support and tracing.
application/json
{
  "$ref": "#/components/schemas/ReportAccepted"
}

Report accepted and queued

{
  "events_url": "/v1/reports/rep_7f12a4c8/events",
  "external_id": "document-123",
  "report_id": "rep_7f12a4c8",
  "status": "queued",
  "status_url": "/v1/reports/rep_7f12a4c8"
}
401Missing, invalid, inactive or revoked API key.
X-Request-IDIdentifier to retain for support and tracing.
application/problem+json
{
  "$ref": "#/components/schemas/ApiProblem"
}
409Idempotency-Key was reused with a different payload.
X-Request-IDIdentifier to retain for support and tracing.
application/problem+json
{
  "$ref": "#/components/schemas/ApiProblem"
}
413Text exceeds the configured word limit.
X-Request-IDIdentifier to retain for support and tracing.
application/problem+json
{
  "$ref": "#/components/schemas/ApiProblem"
}
422Request validation failed, including an unknown domain_slug/text_type_slug pair.
X-Request-IDIdentifier to retain for support and tracing.
application/problem+json
{
  "$ref": "#/components/schemas/ApiProblem"
}
429Rate limit exceeded.
X-Request-IDIdentifier to retain for support and tracing.Retry-AfterSeconds to wait before a retry can be attempted.
application/problem+json
{
  "$ref": "#/components/schemas/ApiProblem"
}
503The analysis queue is unavailable.
X-Request-IDIdentifier to retain for support and tracing.Retry-AfterSeconds to wait before a retry can be attempted.
application/problem+json
{
  "$ref": "#/components/schemas/ApiProblem"
}
get/v1/reports/{report_id}

Consultar l’estat i el resultat

Retorna l’estat actual. En queued/running cal respectar Retry-After; completed i failed són terminals.

Authorization: Bearer ARTEXT_API_KEY

Parameters

report_idpath · required

Unique report identifier returned by POST /v1/reports.

Responses

200Successful Response
Retry-AfterPresent for queued/running reports; wait at least this many seconds before polling again.X-Request-IDIdentifier to retain for support and tracing.
application/json
{
  "$ref": "#/components/schemas/Report"
}

Report queued

{
  "events_url": "/v1/reports/rep_7f12a4c8/events",
  "external_id": "document-123",
  "report_id": "rep_7f12a4c8",
  "status": "queued",
  "status_url": "/v1/reports/rep_7f12a4c8"
}

Report completed

{
  "error": null,
  "external_id": "document-123",
  "position_in_queue": null,
  "report_id": "rep_7f12a4c8",
  "result": {
    "genre": {
      "domain": {
        "name": "Llenguatge clar",
        "slug": "llenguatge-clar"
      },
      "text_type": {
        "name": "Text juridicoadministratiu dirigit a la ciutadania",
        "slug": "text-juridic-administratiu-dirigit-a-la-ciutadania"
      }
    },
    "language": "ca",
    "measurements": [
      {
        "implementation_version": "1.0",
        "metric_id": "word-count",
        "unit": "words",
        "value": 12
      }
    ],
    "offset_unit": "unicode_code_points",
    "schema_version": "1.0",
    "suggestions": [
      {
        "category": "lexical",
        "explanation": null,
        "id": "sug_1",
        "implementation_version": "1.0",
        "metric_id": "redundant-expressions",
        "metric_title": "Eliminaci\u00f3 d\u2019expressions redundants",
        "occurrences": [
          {
            "alternatives": [],
            "edits": [
              {
                "end": 16,
                "start": 0,
                "text": ""
              }
            ],
            "end": 16,
            "id": "occ_1",
            "paragraph_index": 0,
            "replacement": null,
            "sentence_index": 0,
            "start": 0,
            "text": "En el dia d\u2019avui"
          }
        ],
        "recommendations": [
          "Elimina l\u2019expressi\u00f3 si el context ho permet."
        ],
        "severity": "warning",
        "summary": "Conv\u00e9 formular el fragment d\u2019una manera m\u00e9s directa."
      }
    ]
  },
  "status": "completed"
}

Report failed

{
  "error": {
    "code": "analysis_failed",
    "message": "The analysis could not be completed."
  },
  "external_id": "document-123",
  "position_in_queue": null,
  "report_id": "rep_7f12a4c8",
  "result": null,
  "status": "failed"
}
401Missing, invalid, inactive or revoked API key.
X-Request-IDIdentifier to retain for support and tracing.
application/problem+json
{
  "$ref": "#/components/schemas/ApiProblem"
}
404Report not found.
X-Request-IDIdentifier to retain for support and tracing.
application/problem+json
{
  "$ref": "#/components/schemas/ApiProblem"
}
429Status rate limit or minimum polling interval exceeded.
X-Request-IDIdentifier to retain for support and tracing.Retry-AfterSeconds to wait before a retry can be attempted.
application/problem+json
{
  "$ref": "#/components/schemas/ApiProblem"
}
503Request protection is temporarily unavailable.
X-Request-IDIdentifier to retain for support and tracing.Retry-AfterSeconds to wait before a retry can be attempted.
application/problem+json
{
  "$ref": "#/components/schemas/ApiProblem"
}
422Validation Error
X-Request-IDIdentifier to retain for support and tracing.
application/problem+json
{
  "$ref": "#/components/schemas/ApiProblem"
}
get/v1/reports/{report_id}/events

Rebre transicions per SSE

Canal SSE opcional amb l’estat inicial, canvis i heartbeats. Es tanca en acabar; el polling continua sent el mecanisme de reserva.

Authorization: Bearer ARTEXT_API_KEY

Parameters

report_idpath · required

Unique report identifier returned by POST /v1/reports.

Responses

200SSE status stream.
X-Request-IDIdentifier to retain for support and tracing.
text/event-stream
{
  "type": "string"
}

A stream closes after completed or failed

"event: status\\ndata: {\"report_id\":\"rep_7f12a4c8\",\"status\":\"running\",\"updated_at\":\"2026-07-15T10:00:02Z\"}\\n\\nevent: status\\ndata: {\"report_id\":\"rep_7f12a4c8\",\"status\":\"completed\",\"updated_at\":\"2026-07-15T10:00:06Z\"}\\n\\n"
401Unauthorized
X-Request-IDIdentifier to retain for support and tracing.
application/problem+json
{
  "$ref": "#/components/schemas/ApiProblem"
}
404Not Found
X-Request-IDIdentifier to retain for support and tracing.
application/problem+json
{
  "$ref": "#/components/schemas/ApiProblem"
}
429Too Many Requests
X-Request-IDIdentifier to retain for support and tracing.Retry-AfterSeconds to wait before a retry can be attempted.
application/problem+json
{
  "$ref": "#/components/schemas/ApiProblem"
}
503Service Unavailable
X-Request-IDIdentifier to retain for support and tracing.Retry-AfterSeconds to wait before a retry can be attempted.
application/problem+json
{
  "$ref": "#/components/schemas/ApiProblem"
}
422Validation Error
X-Request-IDIdentifier to retain for support and tracing.
application/problem+json
{
  "$ref": "#/components/schemas/ApiProblem"
}
get/v1/metrics

List metric implementations

Returns measurement and suggestion implementations, including inactive variants and localized documentation. Narrowing the request to a genre reports which metrics that genre actually evaluates.

Authorization: Bearer ARTEXT_API_KEY

Parameters

analysis_languagequery

Language implementation to return: es, ca or en.

documentation_languagequery

Language used for titles and documentation: es, ca or en.

kindquery

Filter by measurement or suggestion.

enabledquery

Filter by the current implementation status.

domain_slugquery

Text domain of a genre, as listed by GET /v1/text-types.

text_type_slugquery

Text type (genre) inside domain_slug, as listed by GET /v1/text-types.

Responses

200Metric implementations and their documentation.
X-Request-IDIdentifier to retain for support and tracing.
application/json
{
  "$ref": "#/components/schemas/MetricCatalog"
}
401Missing, invalid, inactive or revoked API key.
X-Request-IDIdentifier to retain for support and tracing.
application/problem+json
{
  "$ref": "#/components/schemas/ApiProblem"
}
422Incomplete or unknown genre filter.
X-Request-IDIdentifier to retain for support and tracing.
application/problem+json
{
  "$ref": "#/components/schemas/ApiProblem"
}
get/v1/metrics/{metric_id}

Get one metric implementation

Returns the status, category and localized documentation for one language variant, optionally narrowed to a genre.

Authorization: Bearer ARTEXT_API_KEY

Parameters

metric_idpath · required

Stable conceptual metric identifier.

analysis_languagequery · required

Language implementation to return: es, ca or en.

documentation_languagequery

Language used for titles and documentation: es, ca or en.

domain_slugquery

Text domain of a genre, as listed by GET /v1/text-types.

text_type_slugquery

Text type (genre) inside domain_slug, as listed by GET /v1/text-types.

Responses

200Successful Response
X-Request-IDIdentifier to retain for support and tracing.
application/json
{
  "$ref": "#/components/schemas/Metric"
}
401Missing, invalid, inactive or revoked API key.
X-Request-IDIdentifier to retain for support and tracing.
application/problem+json
{
  "$ref": "#/components/schemas/ApiProblem"
}
404Metric implementation not found.
X-Request-IDIdentifier to retain for support and tracing.
application/problem+json
{
  "$ref": "#/components/schemas/ApiProblem"
}
422Incomplete or unknown genre filter.
X-Request-IDIdentifier to retain for support and tracing.
application/problem+json
{
  "$ref": "#/components/schemas/ApiProblem"
}
get/v1/text-types

List text domains and genres

Returns the domains (ámbitos) and the genres (text types) available for a language. The slug pair of a genre is what POST /v1/reports expects.

Authorization: Bearer ARTEXT_API_KEY

Parameters

languagequery

Catalog language: es, ca or en.

Responses

200Editorial catalog for the requested language.
X-Request-IDIdentifier to retain for support and tracing.
application/json
{
  "$ref": "#/components/schemas/PublicTextTypeCatalog"
}
401Missing, invalid, inactive or revoked API key.
X-Request-IDIdentifier to retain for support and tracing.
application/problem+json
{
  "$ref": "#/components/schemas/ApiProblem"
}
422Unsupported language.
X-Request-IDIdentifier to retain for support and tracing.
application/problem+json
{
  "$ref": "#/components/schemas/ApiProblem"
}
get/v1/text-types/{domain_slug}/{text_type_slug}

Get one genre

Returns the sections and contents recommended for a genre, plus the exact report_defaults to forward to POST /v1/reports.

Authorization: Bearer ARTEXT_API_KEY

Parameters

domain_slugpath · required

Text domain of a genre, as listed by GET /v1/text-types.

text_type_slugpath · required

Text type (genre) inside domain_slug, as listed by GET /v1/text-types.

languagequery

Catalog language: es, ca or en.

Responses

200Genre detail and its report defaults.
X-Request-IDIdentifier to retain for support and tracing.
application/json
{
  "$ref": "#/components/schemas/PublicTextTypeDetail"
}
401Missing, invalid, inactive or revoked API key.
X-Request-IDIdentifier to retain for support and tracing.
application/problem+json
{
  "$ref": "#/components/schemas/ApiProblem"
}
404Genre not found for this language.
X-Request-IDIdentifier to retain for support and tracing.
application/problem+json
{
  "$ref": "#/components/schemas/ApiProblem"
}
422Unsupported language.
X-Request-IDIdentifier to retain for support and tracing.
application/problem+json
{
  "$ref": "#/components/schemas/ApiProblem"
}