# Add an objetivo

`POST https://api.fiscalisto.com/v1/review_objectives`

An objetivo of a person in a cycle, with its target, unit and weight (up to 20 per person). Their boss scores it when reviewing them and the person logs their progress in their portal. No more can be added once the boss reviewed them.

## Parameters

| Name | In | Required | Description |
| --- | --- | --- | --- |
| `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). |

## Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `cycle` | string | yes | The cycle (rvc_…). (up to 80 characters) |
| `employee` | string | yes | The person (emp_…). (up to 80 characters) |
| `title` | string | yes | What they have to achieve. (up to 200 characters) |
| `target` | number or null |  | The target, if measured with a number. |
| `actual` | number or null |  | The progress. |
| `unit` | string or null |  | The unit: pesos, %, pieces. |
| `lower_better` | boolean |  | The target is a maximum (complaints, waste): less is better. |
| `weight` | number |  | How much it counts against their other objetivos. By default, 1. (greater than 0 and up to 100) |
| `note` | string or null |  | A note. |

Example:

```json
{
  "cycle": "rvc_OufpKqnrvx9p6PoIuYtReWqAsDfGhJkL",
  "employee": "emp_OufpKqnrvx9p3RxmD1RIDgEHzKYPYnYBlV",
  "title": "Vender 1,200 piezas",
  "target": 1200,
  "actual": 950,
  "unit": "piezas",
  "weight": 2
}
```

## With the TypeScript SDK

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

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

const reviewObjective = await fiscalisto.reviewObjectives.create({
  cycle: "rvc_OufpKqnrvx9p6PoIuYtReWqAsDfGhJkL",
  employee: "emp_OufpKqnrvx9p3RxmD1RIDgEHzKYPYnYBlV",
  title: "Vender 1,200 piezas",
  target: 1200,
  actual: 950,
  unit: "piezas",
  weight: 2,
}, { idempotencyKey: "pedido-A-1042" });
```

## With the Python SDK

```python
from fiscalisto import Fiscalisto

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

review_objective = fiscalisto.review_objectives.create({
    "cycle": "rvc_OufpKqnrvx9p6PoIuYtReWqAsDfGhJkL",
    "employee": "emp_OufpKqnrvx9p3RxmD1RIDgEHzKYPYnYBlV",
    "title": "Vender 1,200 piezas",
    "target": 1200,
    "actual": 950,
    "unit": "piezas",
    "weight": 2,
}, idempotency_key="pedido-A-1042")
```

## With the PHP SDK

```php
<?php

use Fiscalisto\Fiscalisto;

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

$reviewObjective = $fiscalisto->reviewObjectives->create([
    'cycle' => 'rvc_OufpKqnrvx9p6PoIuYtReWqAsDfGhJkL',
    'employee' => 'emp_OufpKqnrvx9p3RxmD1RIDgEHzKYPYnYBlV',
    'title' => 'Vender 1,200 piezas',
    'target' => 1200,
    'actual' => 950,
    'unit' => 'piezas',
    'weight' => 2,
], ['idempotency_key' => 'pedido-A-1042']);
```

## With the .NET SDK

```csharp
using Fiscalisto;

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

var reviewObjective = await fiscalisto.ReviewObjectives.CreateAsync(new CreateReviewObjectiveParams
{
    Cycle = "rvc_OufpKqnrvx9p6PoIuYtReWqAsDfGhJkL",
    Employee = "emp_OufpKqnrvx9p3RxmD1RIDgEHzKYPYnYBlV",
    Title = "Vender 1,200 piezas",
    Target = 1200,
    Actual = 950,
    Unit = "piezas",
    Weight = 2,
}, 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()

	reviewObjective, err := client.ReviewObjectives.Create(ctx, &fiscalisto.CreateReviewObjectiveParams{
		Cycle:    "rvc_OufpKqnrvx9p6PoIuYtReWqAsDfGhJkL",
		Employee: "emp_OufpKqnrvx9p3RxmD1RIDgEHzKYPYnYBlV",
		Title:    "Vender 1,200 piezas",
		Target:   fiscalisto.Float64(1200),
		Actual:   fiscalisto.Float64(950),
		Unit:     fiscalisto.String("piezas"),
		Weight:   fiscalisto.Float64(2),
	}, fiscalisto.WithIdempotencyKey("pedido-A-1042"))
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(reviewObjective.ID)
}
```

## With the Java SDK

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

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

var reviewObjective = fiscalisto.reviewObjectives().create(new CreateReviewObjectiveParams()
        .setCycle("rvc_OufpKqnrvx9p6PoIuYtReWqAsDfGhJkL")
        .setEmployee("emp_OufpKqnrvx9p3RxmD1RIDgEHzKYPYnYBlV")
        .setTitle("Vender 1,200 piezas")
        .setTarget(1200)
        .setActual(950)
        .setUnit("piezas")
        .setWeight(2), RequestOptions.idempotencyKey("pedido-A-1042"));
System.out.println(reviewObjective.getId());
```

## Response 201

OK.

A `ReviewObjective` object:

| Field | Type | Always present | Description |
| --- | --- | --- | --- |
| `id` | string | yes | The objetivo (rvo_…). |
| `object` | `"review_objective"` | yes | What kind of object it is («invoice», «customer»…). |
| `cycle` | string | yes | The cycle (rvc_…). |
| `employee` | string | yes | Whose it is (emp_…). |
| `title` | string | yes | What they have to achieve. |
| `target` | number or null | yes | The target. |
| `actual` | number or null | yes | The progress; the person logs it in their portal or you do here. |
| `unit` | string or null | yes | The unit. |
| `lower_better` | boolean | yes | The target is a maximum: less is better. |
| `weight` | number | yes | How much it counts against their other objetivos. |
| `note` | string or null | yes | A note about the objective. |
| `achievement` | number or null | yes | % achieved: progress over target, or the other way with lower_better. null without both. |
| `score` | number or null | yes | The score their boss gave it when reviewing them. |

```json
{
  "id": "rvo_OufpKqnrvx9p4NmBvCxZaSdFgHjKlQwE",
  "object": "review_objective",
  "cycle": "rvc_OufpKqnrvx9p6PoIuYtReWqAsDfGhJkL",
  "employee": "emp_OufpKqnrvx9p1aZ8hR4mKtWq2YbNcVxLpe",
  "title": "Vender 1,200,000 en el año",
  "target": 1200000,
  "actual": 1080000,
  "unit": "pesos",
  "lower_better": false,
  "weight": 2,
  "note": null,
  "achievement": 90,
  "score": 4
}
```

## Errors

- `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.
- `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).

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