# Contracts

## List all accessible contracts

> This operation is retrieving a list of contracts that your account credentials are authorized to access. This operation is primarily useful to IONOS' Resellers, as a non-reseller user account will only have access to a single contract.

```json
{"openapi":"3.0.3","info":{"title":"Activity Log Service API","version":"v1"},"tags":[{"name":"Contracts"}],"servers":[{"url":"https://api.ionos.com"}],"security":[{"Basic_Authentication":[]},{"Token_Authentication":[]}],"components":{"securitySchemes":{"Basic_Authentication":{"type":"http","description":"You will need to base64 encode the string containing your credentials. <div style=\"padding: 15px; border: 1px solid #d1ecf1; background-color: #d1ecf1; color: #0c5460; margin-bottom: 15px;\">\n  <strong>Note:</strong><br/><br/>\n   <ul><li><b>Basic Authentication</b> is supported only when <b>2-Factor \n  Authentication</b> is not configured.</li>\n  <li>Users with <b>2-Factor \n  Authentication</b> activated must generate new 2FA-secured tokens in the DCD using [Token Manager](https://docs.ionos.com/cloud/set-up-ionos-cloud/management/identity-access-management/token-manager). \n  These tokens do not inherit the <b>2FA-secured</b> property by default.</li><li>Token deletion is only possible using the <b>Token Manager</b>.</li>\n</div> Separate your username and password with a colon, i.e., username:password and send it as 'Authorization' request header. More details: https://en.wikipedia.org/wiki/Basic_access_authentication\n","scheme":"basic"},"Token_Authentication":{"type":"apiKey","name":"Authorization","in":"header","description":"Please provide header value as 'Bearer ' and don't forget to add 'Bearer' HTTP Authorization Scheme before the token."}},"schemas":{"ReferenceById":{"description":"Describes a reference to a specific activity log source.","type":"object","properties":{"id":{"type":"integer","format":"int64","description":"The Contract ID"},"type":{"type":"string","description":"A string indicating the type"},"href":{"type":"string","format":"uri","description":"A URL reference"}}}}},"paths":{"/activitylog/v1/contracts":{"get":{"tags":["Contracts"],"summary":"List all accessible contracts","description":"This operation is retrieving a list of contracts that your account credentials are authorized to access. This operation is primarily useful to IONOS' Resellers, as a non-reseller user account will only have access to a single contract.","operationId":"getAvailableContracts","responses":{"200":{"description":"Successful operation","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ReferenceById"}}}}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"500":{"description":"Internal Server Error"}}}}}}
```

## Download Activity Log entries.

> This operation returns the actual activity log data related to the specific \*\*contractId\*\* supplied in the request. The amount of data returned can be limited by providing one or both of the optional \*\*startDate\*\* and \*\*endDate\*\* parameters.\
> \
> &#x20; If valid values for both \*\*dateStart\*\* and \*\*dateEnd\*\* are supplied, then the activity log information for the date range specified will be returned. Omitting either \*\*dateStart\*\* or \*\*dateEnd\*\* will return all entries available after \*\*dateStart\*\* or before \*\*dateEnd\*\*.\
> \
> &#x20; For pagination use the \*\*page\*\* and \*\*size\*\* parameters.<br>

```json
{"openapi":"3.0.3","info":{"title":"Activity Log Service API","version":"v1"},"tags":[{"name":"Contracts"}],"servers":[{"url":"https://api.ionos.com"}],"security":[{"Basic_Authentication":[]},{"Token_Authentication":[]}],"components":{"securitySchemes":{"Basic_Authentication":{"type":"http","description":"You will need to base64 encode the string containing your credentials. <div style=\"padding: 15px; border: 1px solid #d1ecf1; background-color: #d1ecf1; color: #0c5460; margin-bottom: 15px;\">\n  <strong>Note:</strong><br/><br/>\n   <ul><li><b>Basic Authentication</b> is supported only when <b>2-Factor \n  Authentication</b> is not configured.</li>\n  <li>Users with <b>2-Factor \n  Authentication</b> activated must generate new 2FA-secured tokens in the DCD using [Token Manager](https://docs.ionos.com/cloud/set-up-ionos-cloud/management/identity-access-management/token-manager). \n  These tokens do not inherit the <b>2FA-secured</b> property by default.</li><li>Token deletion is only possible using the <b>Token Manager</b>.</li>\n</div> Separate your username and password with a colon, i.e., username:password and send it as 'Authorization' request header. More details: https://en.wikipedia.org/wiki/Basic_access_authentication\n","scheme":"basic"},"Token_Authentication":{"type":"apiKey","name":"Authorization","in":"header","description":"Please provide header value as 'Bearer ' and don't forget to add 'Bearer' HTTP Authorization Scheme before the token."}},"schemas":{"GetByContractResponse":{"description":"Activity log data related to the specific contractId","type":"object","properties":{"hits":{"type":"object","description":"The container for the found activity event data.","properties":{"total":{"type":"integer","description":"A count of total number of available activity events."},"hits":{"type":"array","items":{"type":"object","properties":{"_source":{"type":"object","description":"The payload of a single activity event.","properties":{"principal":{"type":"object","description":"The person or process which triggered the event.","properties":{"sourceIP":{"type":"string","description":"The remote IP address which triggered the activity."},"identity":{"type":"object","description":"The identity of the user who triggered the activity.","properties":{"contractNumber":{"type":"string","description":"The customer contract number."},"username":{"type":"string","description":"The user name."}}},"sourceService":{"type":"string","description":"The principal triggered the activity using this IONOS service.\n\nExample values are \n* `PUBLIC_REST_V6` for the CloudAPI V6,\n* `Reseller_V1` for the Reseller API V1 or\n* `DCD` for the Data Center Designer.\n"},"serviceHost":{"type":"string","description":"The FQDN of the hostname on which the service runs.\n"}}},"meta":{"type":"object","description":"Meta information about the activity event.","properties":{"auditVersion":{"type":"string","description":"The values returned is currently \"0.1\"."},"requestId":{"type":"string","description":"Identifier of the individual request which triggered the activity."},"queueRefId":{"type":"integer","description":"Identifier of the provisioning queue reference. Use this value to group different events that were part of the same provisioning request."},"time":{"type":"string","description":"Combined date and time of the activity event in UTC."},"transactionId":{"type":"string","description":"Identifier of the transaction which triggered the activity."}}},"event":{"type":"object","description":"Details specific to the activity event.","properties":{"param":{"type":"object","description":"Additional parameters for the given `type` of activity event.","properties":{"action":{"type":"string","description":"HTTP protocol method used to trigger the activity.","enum":["GET","POST","PATCH","PUT","DELETE"]},"error":{"type":"object","description":"Details of the error response returned for a given activity.","properties":{"httpStatus":{"type":"string","description":"HTTP error code for the given activity."},"messages":{"type":"array","description":"An array of error messages corresponding to the given activity.","items":{"type":"object","properties":{"errorCode":{"type":"string","description":"Internal error code generated by the given activity."},"message":{"type":"string","description":"Details of the specific error generated by the given activity."}}}}}},"uri":{"type":"string","description":"HTTP URI for the given activity request."},"initiator":{"type":"string","description":"Component which initiated the activity. Usually equivalent to sourceService in the **principal** section."},"errorCode":{"type":"string","description":"Internal error code generated by the given activity."},"sourceService":{"type":"string","description":"The IONOS service in which the activity took place.\n\nExample values are\n`PUBLIC_REST` for the CloudAPI or\n`Provisioning` for events happening during the asynchronous\nresource provisioning process.\n"}}},"resources":{"type":"array","description":"An array of resources affected by the given activity.","items":{"type":"object","properties":{"action":{"type":"array","description":"An array of items containing a string describing the\naction that was performed on the resource. There are\na large number of possible values returned here.\n\nSome example values are \n* in the security domain `sec.user.create` for a user \n  creation, \n* in the IP domain `ip.ipblock.reserve` for reserving an \n  IP block,\n* in the virtual resources domain `vr.firewall.activate` for \n  a firewall activation or\n* in the snapshot domain `sn.snapshot.create` for creating\n  a snapshot.\n","items":{"type":"string"}},"id":{"type":"string","description":"Identifier of the given resource."},"type":{"type":"string","description":"Type of the given resource. Example values are\n\n* `datacenter`,\n* `firewallrule` or\n* `backupUnit`.\n"}}}},"message":{"type":"string","description":"Message explaining the current status of the request."},"status":{"type":"string","description":"The current status of the request.","enum":["DONE","RUNNING","QUEUED","FAILED"]},"type":{"type":"string","description":"Type of the activity event. The exact contents of the `event` object\nwill vary depending on this value.\n\nThere are a large number of possible values, examples are\n* `Error` for a request that couldn't be completed,\n* `RequestAccepted` for an incoming request (e.g. via HTTP),\n* `RequestStatusUpdate` for a later update about a request which was\n  logged earlier,\n* `Provision` for resource provisionings running in the background or \n* `DCDUserEvent` for events about a DCD user.\n"}}}}}}}}}}}}}},"paths":{"/activitylog/v1/contracts/{contractNumber}":{"get":{"tags":["Contracts"],"summary":"Download Activity Log entries.","description":"This operation returns the actual activity log data related to the specific **contractId** supplied in the request. The amount of data returned can be limited by providing one or both of the optional **startDate** and **endDate** parameters.\n\n  If valid values for both **dateStart** and **dateEnd** are supplied, then the activity log information for the date range specified will be returned. Omitting either **dateStart** or **dateEnd** will return all entries available after **dateStart** or before **dateEnd**.\n\n  For pagination use the **page** and **size** parameters.\n","operationId":"getByContract","parameters":[{"name":"contractNumber","in":"path","description":"Contract number thats activity log entires should be downloaded.","required":true,"schema":{"type":"integer"}},{"name":"dateStart","in":"query","description":"Start date for the Activity Log entries (inclusive) (e.g. '2021-09-23T11:43:51Z' or '2016-07-01')","required":false,"schema":{"type":"string"}},{"name":"dateEnd","in":"query","description":"End date for the Activity Log entries (exclusive) (e.g. '2021-09-27T10:31:15Z' or '2016-07-30')","required":false,"schema":{"type":"string"}},{"name":"offset","in":"query","description":"Page index ( the number of hits to skip )","required":false,"schema":{"type":"integer","default":0}},{"name":"limit","in":"query","description":"Page size ( the maximum number of hits to return )","required":false,"schema":{"type":"integer","default":20}}],"responses":{"200":{"description":"Downloading activity log entries","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetByContractResponse"}}}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"500":{"description":"Internal Server Error"}}}}}}
```
