# Schedule API

Create a Voyage with a Loading and Discharging PortCall with one Cargo with a Loading and Discharging CargoPort.&#x20;

&#x20;

<table data-header-hidden><thead><tr><th></th></tr></thead><tbody><tr><td><pre class="language-json"><code class="lang-json">POST /Voyage

{
"ballastPort":102546,
"vessel":1609791,
"cargos":\[
{
"cargoMeasurement":"MT",
"cargoType":"SPOT",
"cargoPorts":\[
{
"cargoPortSequence":1,
"port":105219,
"reasonForCall":"L"
},
{
"cargoPortSequence":1,
"port":101770,
"reasonForCall":"D"
}
]
}
],
"portCallsFromVoyage":\[
{
"port":105219,
"portCallSequence":1,
"reasonForCall":"L",
"currency":"EUR"
},
{
"port":101770,
"portCallSequence":2,
"reasonForCall":"D",
"currency":"EUR"
}
]
} </code></pre></td></tr></tbody></table>

Creating a new Cargo with a Loading and Discharging CargoPort and PortCall. The PortCall objects have EventLogDates that specify Arrival, Berthing, Un-berthing, and Departure dates.

```json
POST /Cargo
 
{
    "cargoMeasurement": "MT",
    "cargoPorts": [
        {
            "cargoPortSequence": 1,
            "cargoQuantity": 1234,
            "laytimeTermsMeasurement": "H",
            "port": {
                "key": 102381
            },
            "portCall": {
                "portCallSequence": 3,
                "reasonForCall": "L",
                "port": 102381,
                "voyage": 6136896
            },
            "reasonForCall": "L"
        },
        {
            "cargoPortSequence": 1,
            "cargoQuantity": 1234,
            "freightRate": 1210,
            "laytimeTermsMeasurement": "H",
            "port": {
                "key": 101486
            },
            "portCall": {
                "portCallSequence": 4,
                "reasonForCall": "D",
                "port": 101486,
                "voyage": 6136896
            },
            "reasonForCall": "D"
        }
    ],
    "charterer": {
        "key": 1004307
    },
    "commodity": {
        "key": 1675975
    },
    "freightCurrency": "USD",
    "voyage": {
        "key": 6136896
    }
}
```

Adding to a Cargo a new Loading or Discharging CargoPort and PortCall

```json
PUT /Cargo/{KEY}
 
{
    "cargoPorts": [
        {
            "key": 18739785
        },
        {
            "key": 18739786
        },
        {
            "port": 103991,
            "reasonForCall": "D",
            "cargoPortSequence": 2,
            "portCall": {
                "portCallSequence": 6,
                "reasonForCall": "D",
                "port": 103991,
                "voyage": 18739534,
                "ownedByVoyage": 18739534
            }
        }
    ]
}

```

Fixing the date on an EventLog object. Note, only EventLogs with EventLog.EventLogDate from the past can be fixed, otherwise, the returned value of isDateFixed will be *false*.

```json
PUT /EventLog/{KEY}

{
    "isDateFixed":true
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api.dataloy.com/api-release-8.7/user-guides/schedule-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
